Null pointer constant
A null pointer constant is a language-defined zero-valued or null-pointer expression that can be converted to a null pointer.
Modern C, Third Edition
A pre-C23 null pointer constant is a compile-time constant expression of integer type and value zero or an expression of type void* that can be converted to a null pointer.
- How it is used
- Distinguishes compile-time null pointer constants from pointer objects holding null values and guides portable use of `NULL`.
- How deep it goes
- Defines the pre-C23 forms, examines permissible `NULL` expansions, and sketches a conditional-expression test without providing its completed macro.
- Examples
- Uses two `const` pointer objects, possible `NULL` expansions, and a conditional expression whose type distinguishes qualifying expressions.
- What you can do after
- Evaluate/understand whether a pre-C23 expression qualifies as a null pointer constant and why `NULL` may hide a type choice.
Read how Modern C, Third Edition explains null pointer constant →
Modern C
A null pointer constant is an integer constant expression with value zero or such a value converted to void pointer, as permitted by the C standard.
- How it is used
- Clarifies how zero-valued constants represent null pointers and why NULL is unsafe in variadic interfaces.
- How deep it goes
- Defines permitted types, distinguishes compile-time constants from const objects, and traces NULL into variadic-call failures.
- Examples
- Uses const pointer declarations, permitted NULL expansions, and a printf call demonstrating variadic type mismatch.
- What you can do after
- Evaluate null-pointer spellings and avoid NULL where its unspecified type can compromise portability.
Related concepts
- missing valueproduced by · A missing value is a marker or condition indicating that an expected data value or reference is absent, unavailable, unknown, or inapplicable.
- macrokind of · A macro is a named construct that expands or transforms source code, commands, or templates before or during execution.
- referencecontrasts with · A reference is an indirect value or relationship that identifies or provides access to another value, object, resource, or source.
- const qualifiercontrasts with · A language feature that marks a value, binding, or access path as constant, restricting reassignment or modification according to the language’s rules.
- void pointeruses · A void pointer is a C pointer of type void* that can hold the address of an object without specifying its pointed-to object type.
- implicit conversioncontrasts with · Implicit conversion is an automatic change of a value from one type to another according to language rules, without an explicit conversion operation in the source code.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

