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 are Boolean gates?

    Answered by Discovery Channel

  • What's the difference between AVI and MOV video files?

    Answered by Science Channel

  • When were silicon photonics first used?

    Answered by Mario Paniccia


What are you curious about?

Image Gallery