We have the code:
int arr[3][4];
So arr is:
-
An array of 3 elements, and every element is an array of 4 int.
-
An array of 4 elements, and every element is an array of 3 int.
which one is right and why? How does it work with higher dimensional array? I suppose this is concerning operator precedence and associativity.
Your first interpretation is correct.
Such declarations are best parsed using the Right Left rule, which you can read here and here
$8.3.4 from the C++ draft Standard:
…
…
Note C++ does not have operator[][]. It has only operator[]