On this page
  1. nullptr
  2. Availability
  3. Syntax & Overview
  4. Notes & Pitfalls
  5. Example

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

Example

#include <assert.h>

int main(void) {
    int *p = nullptr; // C23
    assert(p == nullptr);
}

Linked from

Related notes