Computer Software

How can a pointer be initialized in C?
Answered by Discovery Channel
  • Discovery Channel

    Discovery Channel

  1. In the C programming language, pointer variables are initialized when the pointer points to a known area in your system's memory. There are four ways to accomplish this:

    • Use the malloc statement, which designates a block of memory and then directs the pointer to it. The pointer is initialized because it's been filled with the address of the new memory block.
    • Use a statement like p = q, where q points to a valid memory block. The pointer p will be initialized, because q is already directed at a valid address.
    • Direct the pointer to an address that is already known.
    • Use the value zero with a pointer. Any pointer can be set to zero, and in this state it won't be pointed toward any memory block. It will instead be used as a tag.

     

    More answers from Discovery Channel »



Still Curious?
  • What does it mean when software is said to be "open source"?


    Answered by Discovery Channel

  • What was Storm Worm?


    Answered by Science Channel

  • How is an MP3 file different from a file on a music CD?


    Answered by Science Channel

Advertisement

What are you curious about?

Image Gallery