First, int a[3] = {2 2,3,4};
Here a is the first address of this array, such as int * p = a;; At this point, if you do the following:
p++;
printf("%d\n ",* p);
The result will output 2, which means that p+ 1 is equivalent to the array index plus 1, but as you ask, why&; A and a are & First, we need to know what they stand for. Answer: As mentioned above, it is the first address of the array, and the self-adding operation will calculate the offset according to the array type, so&; What is a? It's actually a pointer, a pointer to a three-element array. How to understand, see the following definitions:
If int * q = &;; a; At this time, the compiler must report an error and draw inconsistent data types, so there is no problem with your definition: int (* q) [3] =&; a; At this time, if you add++to Q again, the addition will be different. For example, the value of p will increase by 4 after p++ operation on the surface, and the value after q++ operation will increase by 12, that is, three array elements will be skipped. But it is true that the initial values of these two pointers are the same, but the types are different, which is very convenient for accessing two-dimensional arrays. This can be further understood by referring to two-dimensional arrays.