Consider these declarations: double const*const nix = 0; double const*const nax = nix; The literal 0 is an integer constant expression with value zero. Used where a pointer is expected, it represents a null pointer. A null pointer constant is not a const-qualified pointer object: “constant” means compile-time constant, and the permitted type is integer or void*. section 11.1.5
double const*const nix = 0;
double const*const nax = nix;
!@%STYLE%@!
{"css":"{\"css\": \"font-weight: bold;\"}","target":"[[{\"line\":0,\"ch\":0},{\"line\":0,\"ch\":12}],[{\"line\":1,\"ch\":0},{\"line\":1,\"ch\":12}],[{\"line\":0,\"ch\":7},{\"line\":0,\"ch\":12}],[{\"line\":1,\"ch\":7},{\"line\":1,\"ch\":12}],[{\"line\":0,\"ch\":0},{\"line\":0,\"ch\":12}],[{\"line\":1,\"ch\":0},{\"line\":1,\"ch\":12}],[{\"line\":0,\"ch\":7},{\"line\":0,\"ch\":12}],[{\"line\":1,\"ch\":7},{\"line\":1,\"ch\":12}]]"}
!@%STYLE%@!
The declarations distinguish a null pointer value from the pointer objects that contain it. section 11.1.5
The C standard permits NULL to expand to several forms:
- 0, 0L, or other integer constant expressions with value zero. section 11.1.5
- (void*)0, which emphasizes that the value is being used as a pointer. section 11.1.5
- NULL has no prescribed underlying type, so using it in a variadic function can be nonportable; implementations may provide int 0 or void* 0. section 16.5.2
Choosing a spelling
Prefer 0 when a null pointer value is sufficient. If the pointer intent must be explicit, use (void*)0 directly. Avoid NULL: its name suggests a pointer constant, but its implementation-defined expansion can obscure its type and break variadic calls such as printf("%p: %s\n", NULL, "print of NULL"). section 11.1.5 section 16.5.2

