2 ms·
Pointer equality (the == and != operators) is well defined for any pointers (of the same type) to any objects. Relational operators (< <= > >=) on pointers hav
by _kst_ 7y ago
Pointer equality (the == and != operators) is well defined for any pointers (of the same type) to any objects.
Relational operators (< <= > >=) on pointers have undefined behavior unless both pointers point to elements of the same array object or just past the end of it. A single non-array object is treated as a 1-element array for this purpose.
(That's for object pointers. Function pointers can be compared for equality, but relational operators on function pointers are invalid.)