CKTIS / C
NULL — null pointer constant macro
NULL from <stddef.h> denotes a null pointer constant. Use it to initialize pointers and compare them with a null value.
Version: C23; repository compiler flag, production runtime not attested
Syntax
#include <stddef.h>
NULLNULL is a macro, not a type or variable. The <stddef.h> header defines it as a null pointer constant; its expansion is implementation-defined.
Conversion to a pointer type produces a null pointer, unequal to a pointer to any object or function. Use p == NULL and p != NULL. Dereferencing a null pointer causes undefined behavior.
Do not assume a particular type for NULL or an all-zero-bit null pointer representation. NULL is not the character \0. In C23, nullptr is a separate predefined constant of type nullptr_t, not another name for the NULL macro.
Examples
#include <stddef.h>
#include <stdio.h>
int main(void)
{
int value = 42;
int *p = NULL;
printf("%d\n", p == NULL);
p = &value;
if (p != NULL) {
printf("%d\n", *p);
}
return 0;
}
Result
1 42
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.