Consider the following code:
a = 56;
int* p = &a;
p = 56;
Does the second line invoke undefined behavior? How about the fourth line?
It’s up to interpretation. While the contiguity requirements of arrays don’t leave much to the imagination in terms of how to layout a multidimensional arrays (this has been pointed out before), notice that when you’re doing
p you’re indexing the 1234th element of the zeroth row of only 80 columns. Some interpret the only valid indices to be 0..79 (
&p being a special case).
Information from the C FAQ which is the collected wisdom of Usenet on matters relevant to C. (I do not think C and C++ differ on that matter and that this is very much relevant.)