Question 5.13

This is strange. NULL is guaranteed to be 0, but the null pointer is not?


When the term ``null'' or ``NULL'' is casually used, one of several things may be meant:

  1. 1. The conceptual null pointer, the abstract language concept defined in question 5.1. It is implemented with...
  2. 2. The internal (or run-time) representation of a null pointer, which may or may not be all-bits-0 and which may be different for different pointer types. The actual values should be of concern only to compiler writers. Authors of C programs never see them, since they use...
  3. 3. The null pointer constant, which is a constant integer 0 (see question 5.2). It is often hidden behind...
  4. 4. The NULL macro, which is #defined to be 0 or ((void *)0) (see question 5.4). Finally, as red herrings, we have...
  5. 5. The ASCII null character (NUL), which does have all bits zero, but has no necessary relation to the null pointer except in name; and...
  6. 6. The ``null string,'' which is another name for the empty string (""). Using the term ``null string'' can be confusing in C, because an empty string involves a null ('\0') character, but not a null pointer, which brings us full circle...

This article uses the phrase ``null pointer'' (in lower case) for sense 1, the character ``0'' or the phrase ``null pointer constant'' for sense 3, and the capitalized word ``NULL'' for sense 4.


Read sequentially: prev next up top


This page by Steve Summit // Copyright 1995 // mail feedback