Understanding the NULL Pointer in C

I found in some code a NULLpointer is defined as follows -

#define NULL ((char *)0)

I found that these code compilations are excellent. But I did not understand how it works. Can someone explain how 0 is sent to a pointer char?

And is it really used as a FILE pointer creating a null -

FILE *fp = NULL;
+4
source share
1 answer

Library C Macro NULL is the value of a null pointer constant. It can be defined as ((void *) 0), 0, or 0L , depending on the compiler provider . Depending on the compiler, a null declaration may be

#define NULL ((char *)0)

or

#define NULL 0L

or

#define NULL 0

FILE, → .

+1

All Articles