Jump to content

C++ Language/Indirection/TypedNull

From Wikibooks, open books for an open world

The traditional NULL macro was really just a int with value 0. This is commonly used as a special value assigned to a pointer variable, having the semantic meaning of "not pointing at anything" (because computers will never try to use their memory at address 0).

Modern C++ uses nullptr instead of NULL, because nullptr has a dedicated std::nullptr_t type.

Additional information about nullptr