On this page
nullptr
Prev: int | Up: builtins | Next: fundamentals
Rel: NULL
Ref: cppreference — nullptr
Tags: #public #prog #c #builtins #tier/standard
Availability
Built-in (Built-in Constant (C23)) — requires no #include header.
Syntax & Overview
nullptr (type: nullptr_t)
Type-safe null pointer constant introduced in C23 to replace ambiguous integer 0 / NULL macros.
Notes & Pitfalls
- C23 type-safe null pointer constant (
nullptr_t): Eliminates the integer-0 ambiguity ofNULLin variadic functions and_Generic.
Example
#include <assert.h>
int main(void) {
int *p = nullptr; // C23
assert(p == nullptr);
}
Linked from
Related notes
- tuts/c/builtins/int Linked here; links to this page; shared tags: #builtins, #c, #prog, #tier
- tuts/c/builtins Linked here; links to this page; shared tags: #builtins, #c, #prog
- tuts/c/stdlib/stddef/NULL Linked here; shared tags: #c, #prog, #tier
- tuts/c/fundamentals Linked here; shared tags: #c, #prog
- tuts/c/builtins/__FILE__ shared tags: #builtins, #c, #prog, #tier
- tuts/c/builtins/__func__ shared tags: #builtins, #c, #prog, #tier
- tuts/c/builtins/__LINE__ shared tags: #builtins, #c, #prog, #tier
- tuts/c/builtins/__STDC_VERSION__ shared tags: #builtins, #c, #prog, #tier
- tuts/c/builtins/_Alignof shared tags: #builtins, #c, #prog, #tier
- tuts/c/builtins/_Atomic shared tags: #builtins, #c, #prog, #tier