C++ – Pointer comparison

c++pointers

Do pointers in C and C++ support comparison operators (>, <, etc.) in standard?

I want to compare array positions to be precise.

Best Solution

In a contiguous array comparing memory offsets (pointers) is OK. If your array is implemented as a linked list (for example) the nodes could be all over memory so pointer comparison is nonsensical.