There are times when it's necessary to have a pointer that doesn't point to anything. The macro NULL, defined in <stddef.h>, has a value that's guaranteed to be different from any valid pointer. NULL is a literal zero, possibly cast to void* or char*. Some people, notably C++ programmers, prefer to use 0 rather than NULL.<stddef.h>
A void pointer is a C convention for "a raw address." The compiler has no idea what type of object a void pointer "really points to." If you write
ip points to an int. If you write
p doesn't point to a void!
(A variable that stores address of other variable)
(near=2 far=4 huge=4)
(stdio.h and stddef.h)
9. Can you combine the following two statements into one?
p = (char*) malloc(100);
A. char p = *malloc(100);
B. char *p = (char) malloc(100);
C. char *p = (char*)malloc(100);
D. char *p = (char *)(malloc*)(100);
(char *p = (char*)malloc(100);)
(Representation of NULL pointer)