|
C Pointers - August 06, 2008 at 13:10 PM by Amit Satpute
Compare array with pointer.
Answer
The following declarations are NOT the same:
char *p;
char a[20];
The first declaration allocates memory for a pointer; the second allocates
memory for 20 characters.
What is NULL pointer?
Answer
A null pointer does not point to any object.
NULL and 0 are interchangeable in pointer contexts.Usage of NULL should be
considered a gentle reminder that a pointer is involved.
It is only in pointer contexts that NULL and 0 are equivalent. NULL should not
be used when another kind of 0 is required.
|