The C++11 keyword for a null pointer, it can be converted to any pointer type. Also available in C23 through stddef.h. Always use this tag either in combination with the C++ or the C tag.
In C++, nullptr
is a null pointer constant of type std::nullptr_t
which can be implicitly converted to any pointer type. An integer constant 0
can also be converted to any pointer type but can also be deduced as an integer in other contexts, leading to ambiguities. See What exactly is nullptr?
In C ("C23" ISO 9899:202x), nullptr
is similarly a null pointer constant of type nullptr_t
found in stddef.h
. It can get converted to a void*
, bool
or a pointer type.