Is NULL always zero in C?

§ 6.3.2.3 of the C99 standard says

An integer constant expression with the value 0, or such an expression cast to type void *, is called a null pointer constant) If a null pointer constant is converted to a pointer type, the resulting pointer, called a null pointer, is guaranteed to compare unequal to a pointer to any object or function.

§ 7.17 also says

[...] NULL which expands to an implementation-defined null pointer constant [...]

The address of the NULL pointer might be different from 0, while it will behave like it was in most cases.

(This should be the same as in older C standards, which I don't have at hand right now)


The null pointer constant is always 0. The NULL macro may be defined by the implementation as a naked 0, or a cast expression like (void *) 0, or some other zero-valued integer expression (hence the "implementation defined" language in the standard).

The null pointer value may be something other than 0. When a null pointer constant is encountered, it will be converted to the proper null pointer value.


I'm assuming you mean the null pointer. It is guaranteed to compare equal to 0.1 But it doesn't have to be represented with all-zero bits.2

See also the comp.lang.c FAQ on null pointers.


  1. See C99, 6.3.2.3.
  2. There's no explicit claim; but see the footnote for C99, 7.20.3 (thanks to @birryree in the comments).