I have found in some code NULL
pointer is defined as follows -
#define NULL ((char *)0)
I found these code compiles fine. But I did not understand how this works. Can anyone please explain how 0 is casted to a char
pointer?
And is it valid to use it as a FILE pointer making null -
FILE *fp = NULL;
The C library Macro NULL is the value of a null pointer constant.It may be defined as ((void*)0), 0 or 0L depending on the compiler vendor. Depending on compiler,declaration of NULL can be
or
or