What does NULL mean?

This is a discussion on What does NULL mean? within the C++ Programming forums, part of the General Programming Boards category; What exactly does NULL mean? An example and explanation of it in code, would be cool. But a simple overview ...

Well here's a definition: http://en.wikipedia.org/wiki/Null
Say there is a function that has an extra parameter that you can use to set additional options. If you don't want those additional options you can pass NULL for that parameter. NULL is kind of like a spaceholder for nothing.

Sentral,
NULL = 0, or hex 0x00000000, or binary 000000000000. Its stated in the compiler, #define NULL 0, try hovering over NULL in Visual C++, u'll see how it defines it. When you set a pointer to NULL you are actually setting it to address 0x00000000 which is a placeholder address that points to nada or shorthand - 0.

7stud,
I use NULL for an int sometimes when I'm lazy. You sayin I'm not a "real" programmer? Them's fightin words!

Not quite right that NULL is kind of like a place holder for nothing? How so? I said kind of because NULL=0 and 0 is important so I wouldn't consider it nothing, although it represents nothing. I usually use 0 if the function is asking for an integer value, but sometimes I use NULL, it all depends.

Although, if you can show me that the standard says NULL must be defined as 0 then you would be right

Originally Posted by C++ Standard, 18.1.4

The macro NULL is an implementation-defined C + + null pointer constant in this International Standard (4.10).180)
180) Possible definitions include 0 and 0L, but not (void*)0.

Originally Posted by C++ Standard, 4.10.1

A null pointer constant is an integral constant expression (5.19) rvalue of integer type that evaluates to
zero. A null pointer constant can be converted to a pointer type; the result is the null pointer value of that
type and is distinguishable from every other value of pointer to object or pointer to function type. Two null
pointer values of the same type shall compare equal. The conversion of a null pointer constant to a pointer
to cv-qualified type is a single conversion, and not the sequence of a pointer conversion followed by a qualification
conversion (4.4).

Basically NULL doesn't point to "nothing" because 0 is "something". What it does is points to a location that you know you can't use.