Re: pointer doubt (1)

Discussion in 'C Programming' started by Eric Sosman, May 8, 2013.

  1. Eric Sosman

    Eric Sosman Guest

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


    "NULL" is a macro defined by several of the standard headers.
    It expands to a value that can be stored in any pointer variable,
    a special value meaning "This pointer has no target" or "This
    pointer points nowhere."

    "void" (not "VOID") is a type, like "int" or "float". An
    "int*" can point at an "int" and a "float*" can point at a "float".
    The special magic about a "void*" -- a pointer to "void" -- is
    that it can point at any data type. The "void*" is useful when
    you need a "pointer to something-or-other" and don't need or want
    to worry about what the something-or-other is.

    See the comp.lang.c Frequently Asked Questions (FAQ) page
    at <http://www.c-faq.com/>; Section 4 covers pointers, Section 5
    is specifically about null pointers and NULL, and mentions of
    "void*" are sprinkled throughout.

    --
    Eric Sosman
    d
    Eric Sosman, May 8, 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:
    663
    Chris Torek
    Feb 4, 2005
  2. Bob Nelson

    doubt about doubt

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

Share This Page