...
Note that undefined behavior occurs only when a
is assigned to b
. It is valid for a
and b
to reference the point into the same array object because what matters is which elements are accessed. Provided the range of elements accessed through one of the pointers does not overlap with the range of elements accessed through the other pointer, there is no undefined behavior.
...