What is Difference between null macro and null pointer? |
[Edit] |
Using a NULL macro to make C portable
I'll assume that you're asking your question for C type language programming. A NULL pointer is a pointer that's guarnteed to point to nothing. This may be 0 in a UNIX/Linux system or some other address in another system. Using the NULL macro to set/initialize your pointers will make your programs more portable among systems than using something like the 0.
#include <stdio.h>
char *c = 0; // initialize to NULL--not portable
char *p = NULL; // initialize to NULL as defined in stdio is portable
First answer by ID1247666205. Last edit by ID1247666205. Question popularity: 20 [recommend question]
|
Research your answer: |



