In C, is it OK to compare pointers to NULL using the <
or >
operators? Or is that undefined behavior?
if (NULL < p) {
// Is this comparison always true?
// Or is it undefined behavior?
}
I remember hearing somewhere that <
comparison is only well-defined if the two pointers point to the same "object". But what about NULL pointers?