How does pointer comparison work in C? Is it ok to compare pointers that don’t point to the same array?
According to the C11 standard, the relational operators <, <=, >, and >= may only be used on pointers to elements of the same array or struct object. This is spelled out in section 6.5.8p5: When two pointers are compared, the result depends on the relative locations in the address space of the objects pointed … Read more