The standard does not prescribe any behavior for
(void*)-1;
except to suggest making the mapping between integral numbers and pointers natural for the underlying platforms addressing model.
Thus, if your implementation allows creation of invalid pointers, that will likely be a void-pointer value with all bits set.
A null pointer is represented in source by a constant integral expression (possibly cast to void*
), or in some implementation-defined manner.
On most modern systems, it's a void-pointer with all bits clear.
So, while the two can be identical, that's unlikely, especially on modern systems.
Also, that second one is very unlikely to be a valid pointer.