- 论坛徽章:
- 0
|
因为 NULL不是C标准里定义的,所以 不一定是0. 可以是别的值。不同的系统或编译器可能存在NULL不为0的情况。但而大多数会把NULL定义为零!
回复 76# zhangsuozhu
你看过c的标准吗?
6.3.2.3 Pointers
3 An integer constant expression with the value 0, or such an expression cast to type
void *, is called a null pointer constant.55) If a null pointer constant is converted to a
pointer type, the resulting pointer, called a null pointer, is guaranteed to compare unequal
to a pointer to any object or function.
55) The macro NULL is defined in <stddef.h> (and other headers) as a null pointer constant; see 7.17. |
|