I'm currently learning how to manipulate multidimensional array in c
I have the following code
int t[2][2] = {
{12, 14},
{16, 18}
};
int * p = t[0];
printf("%d\n", *(p + 2));
And 16
is printed.
But my question is, I'm accessing the third element of the first array that only contained two int elements, is the behaviour for this kind of access undefined?
I understand the behaviour for accessing out of bound index for a single dimensional array is undefined. e.g.
int ar[] = {11, 22};
printf("%d\n", ar[2]); //behaviour undefined
But is it also true for multidimensional array?