NULL3const
Null pointer constant
Usage
#include <stddef.h>
#define NULL ((void *) 0)
Library
Standard C library (libc)
Overview
NULL represents a null pointer constant, that is, a pointer that does not point to anything.
Notes
The following headers also provide NULL: <locale.h>, <stdio.h>, <stdlib.h>, <string.h>, <time.h>, <unistd.h>, and <wchar.h>.
Caveats
It is undefined behavior to dereference a null pointer, and that usually causes a segmentation fault in practice.
It is also undefined behavior to perform pointer arithmetic on it.
NULL - NULL is undefined behavior, according to ISO C, but is defined to be 0 in C++.
To avoid confusing human readers of the code, do not compare pointer variables to 0, and do not assign 0 to them. Instead, always use NULL.
NULL shouldn't be confused with NUL, which is an ascii(7) character, represented in C as '\0'.
Releases
3 releases since Debian 12 (Bookworm); the text changed 2 times.