Confusing Nulls in c [closed]
Please explain following things in regard of C or C++:
The null pointer
The internal representation of a null pointer
The null pointer constant - 0
The NULL macro
The ASCII null character (NUL)
The null string ("").
开发者_开发技巧
The null pointer is a pointer that doesn't point to any object.
The internal representation is not specified, and specifically doesn't have to be all bits zero.
The value 0 can be converted to a null pointer.
The NULL macro is defined as a value that can be converted to a null pointer, in C++ it is often just 0
and in C often (void*)0
, but can be other values as well if the implementation decides so.
The NUL character is a character that has the value 0
or '\0'
.
The string ""
is just an empty string.
精彩评论