Another question about the C standard. I checked this, and I always get NULL < ptr true, where ptr is any pointer other than NULL . But I know that the Standard says that pointer arithmetic and comparison are defined only within the boundaries of the array. I'm just not sure that a specific NULL < ptr comparison is legal.
Change I read K & R and I found the following quote:
Any pointer can be meaningfully matched for equality or inequality with zero. But undefined behavior for arithmetic or comparison with pointers that do not point to members of the same array.
I am not sure if this affects the answers already asked to this question. In any case, I'm still not sure that p > NULL always guaranteed or does not return true, where p is a pointer !=NULL .
source share