There is no "
* (a + I) [j]
" anywhere in this program. If you are asking about the fragment
1 2 3
|
int i = 1,j = 1;
int (*m1)[3]=a+i;
int* m2 = m1[j];
| |
then this is what happens:
First, "a+i" is evaluated. a is an array, i is an int.
There is no operator+ that takes an array on the left and an int on the right, so the compiler considers implicit conversions.... Long story short
1) it performs array-to-pointer conversion: 'a' becomes '&a[0]', that is, a new pointer is created that points at the first row of a.
2) it adds i to that pointer. Since i equals 1, this creates a pointer to the second row of a.
3) That pointer is stored in the object called "m1".
4) To evaluate m1[j], it evaluates *(m1 + j), by definition of [].
5) Since j is also 1, the pointer that results from m1+j is pointing at the third row of a.
6) Applying unary * to that pointer, you get the third row of a (that is, an array of 3 int with values {7, 8, 9}
7) Now the code is attempting to initialize a pointer called m2 using the array as the initializer. An array is not a pointer, so this does not work, but again, there is a conversion from array to pointer to its first element, so m1 gets the address of the first element of the third row of a. When you print out *m2, you access that element, which is 7.