Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Re: pointer doubt (1)

Thread Tools

Re: pointer doubt (1)

Ken Brody
Posts: n/a
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*.

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
dotnet doubt can any body clarify my doubt ASP .Net 0 08-22-2012 06:02 AM
Pointer to pointer Vs References to Pointer C++ 4 07-02-2009 10:20 AM
doubt about doubt Bob Nelson C Programming 11 07-30-2006 08:17 PM
passing the address of a pointer to a func that doesnt recieve a pointer-to-a-pointer jimjim C Programming 16 03-27-2006 11:03 PM
Pointer-to-pointer-to-pointer question C Programming 10 02-04-2005 02:57 AM