2 ms·
> it is quite evident that NULL is defined as “0” in C language. It is actually the other way around. The bare numeral 0, in C, is defined to be the null poin
by teddyh 7y ago
> it is quite evident that NULL is defined as “0” in C language.
It is actually the other way around. The bare numeral 0, in C, is defined to be the null pointer when the numeral 0 is encountered in a pointer context. This does not mean that the null pointer actually has anything to do with the value 0. The succeeding if clause in the C program in the article, the one which prints “NULL is 0”, is not even using any pointers! Since the C preprocessor is text-based, the token sequence “if(0 == NULL)” is replaced by the preprocessor with “if(0 == 0)”, which the compiler will interpret as an integer comparison, not a pointer comparison.
For further reading, see http://c-faq.com/null http://c-faq.com/null