# Include <stdio. h>
Int main ()
{
Int I;
Int B [5] = {1, 3, 5, 7, 9 };
Int (* a) [5] = & B;
Int * m = a; // the space in the range of a is determined by the int size.
For (I = 0; I <5; I ++)
{
Printf ("% d \ n", m [I]);
}
Return 0;
}
The output result is 1 2 3 4 5.
Here, int (* a) [5] indicates that a space of five int values is generated in the stack. a indicates the first address of the whole space.
Int * m = a; defines its value offset, that is, an integer pointer * m's first address is the first address of the space opened for
To better analyze the following program, you can better understand it:
# Include <stdio. h>
Int main ()
{
Int I;
Short B [5] = {1, 3, 5, 7, 9 };
Int (* a) [5] = & B;
Short * m = a; // the size of the space in the range depends on the int size.
For (I = 0; I <5; I ++)
{
Printf ("% d \ n", m [I]);
}
Return 0;
}
Output result: 1 2 3 4 5
The Space Generated by (* a) [5] is a space of five int types. The first address of the space is the same as the first address of the array, but it is only a space. The value method is not defined, short * m = a; indicates that the short type is used to obtain the space. This type has no relationship with int (* a) [5], int (*) [5] The value is responsible for generating space, with no type. It is a bit similar to the malloc function.
Careful scrutiny is helpful for in-depth understanding.