C / C++ FAQs & Programming Resources - ProkutFAQ : NullPointer

HomePage Recent Changes Recently Commented Login/Register
Quick Links
Categories
Links

What is a null pointer? How is it different from NULL?

Null pointer is a pointer that is guaranteed not to point to any object.
Note that it is not necessary for a null pointer to have all the bits set to zero.

NULL is a macro which defines a null pointer constant.
From C99:
An integer constant expression with the value 0, or such an expression cast to type void *, is called a null pointer constant.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.

In other words null pointer constant is a syntactic element or a notation which facilitates initialization or assignment of a pointer type with the corresponding null pointer value.


CategoryPointers
 Comments [Hide comments/form]
Page was generated in 0.0157 seconds