Re: pointer doubt (1)

Discussion in 'C Programming' started by Ken Brody, May 10, 2013.

  1. Ken Brody

    Ken Brody Guest

    On 5/8/2013 2:46 PM, rashan wrote:
    > Can ne1 explain me the difference between.... a NULL pointer ... and a
    > VOID pointer.


    Well, I'm not sure who this "ne1" person is, but I'll take a shot...


    "What is the difference between an empty box and a cardboard box?"


    Now, assuming you meant a "null pointer" and a "void pointer" (using ALL
    CAPS for emphasis)...

    A "null pointer" is a pointer, of any type, which points to nothing. (It
    "points" to a special location, which can be referred to as NULL, which has
    a special meaning of "nowhere".)

    A "void pointer" is a specific *type* of pointer -- one which can point to
    *any* type of value.

    Note that a pointer can be both a "void pointer" and a "null pointer":

    void *foo = NULL;


    In short, a "null pointer" is a pointer which contains a specific *value*,
    whereas a "void pointer" is a pointer of a particular *type*.
    Ken Brody, May 10, 2013
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    10
    Views:
    673
    Chris Torek
    Feb 4, 2005
  2. Bob Nelson

    doubt about doubt

    Bob Nelson, Jul 28, 2006, in forum: C Programming
    Replies:
    11
    Views:
    603
  3. Replies:
    0
    Views:
    542
  4. Peter Otten
    Replies:
    2
    Views:
    104
    Cousin Stanley
    Aug 10, 2013
  5. Terry Reedy
    Replies:
    0
    Views:
    109
    Terry Reedy
    Aug 10, 2013
Loading...

Share This Page