I don't see the problem. As far as I know there is a difference between a pointer pointing to 0 and a pointer pointing to a memory address that contains the value 0.
First off, the OP isn't actually asking about pointers - NULL in his inquiry confused me at first, too.

He's asking about the notion of an uninitialized value, where zero is a valid, initialized quantity - but he needs to 'sense' when a value is not initialized, that is - a STATE of null, like NULL in a SQL database, as opposed to zero.


Second: (tongue in cheek)

A pointer is something that contains a memory location.

Zero is never a valid memory location.

If a pointer is pointing to a memory address that contains the value 0, the meaning is not clearly defined. What type is the pointer, or at least, of the data to which it points? How many zeros follow this first one? The two are related..

If the memory address pointed to by the pointer has a zero, but the next byte has a 1, and the type is a 16 bit integer - then the answer as to what the value is depends on the endianness of the machine.

However, the memory address to which the pointer points can't be zero, since zero can't be a valid address.


In this situation, when a pointer contains a zero, it is thought of as NULL - and that's a state, not a value (though we must simply understand it as a state).

In the OP's question, state may be independent of value. The value may be uninitialized garbage if it is known that the state is null.

If the state is not null, the value should contain meaningful data, which includes zero.

Hence, the suggestions of using <0 as a 'signal' of state (something we simply agree upon, like zero being state for a pointer).

Or, the suggestions that a separate bool be used to indicate state, perhaps documenting that false indicates NULL, true indicates valid data.