4 ms·
Any valid pointer values can be compared for equality. Only pointers that point within a single object (like an array, or a struct) can be compared for ordering
by YSFEJ4SWJUVU6 9y ago
Any valid pointer values can be compared for equality. Only pointers that point within a single object (like an array, or a struct) can be compared for ordering. Nesting doesn't matter as long as down the line there's a common "parent" of sorts. (That is, if you want to have well-defined behaviour.)
(Edit: and for any pointers that you can compare for ordering, you may also calculate their offset from one another. However, like GP said, in practice you can do that for any pointers on common platforms.)