# Include <stdio. h> int main (void) {int A [2] [3]; printf ("% P \ n", a); printf ("% d \ n ", sizeof (a); printf ("% P \ n", A + 1); printf ("% d \ n", sizeof (a + 1 )); printf ("% P \ n", * (a + 1); printf ("% d \ n", sizeof (* (a + 1 ))); return 0 ;}
The aboveCodeThe execution result is:
0xbfc094b8
24
0xbfc094c4
4
0xbfc094c4
12
A is a constant pointer. sizeof (a) obtains the size of the entire array, 2*3*4 = 24 bytes.
A + 1 is a "pointer to an array containing three integer elements", so sizeof (a + 1) only obtains the size of a normal integer pointer. In my system, it is 4 bytes.
* (A + 1) identifies a sub-array containing three integer elements. Its type is "pointer to an integer", which is a constant pointer, similar to, but the element in array a is int [3], and * (a + 1) points to the array element is int. The result is 3*4 = 12 bytes.