The "trap" that should be paid attention to when calculating the array name and address is counted as trap.
"Trap" should be noted when calculating the array name and address"
View the Code directly:
# Include <stdio. h> int main () {int array [5]; printf ("array: % p \ n", array); printf ("array + 2: % p \ n ", array + 2); printf ("& array + 2: % p \ n", & array + 2); return 0 ;}
Program output:
Array name as the pointer array is not easy to talk about, but to get the address & array of the array name, the result is a pointer to the entire array, note that this is not just a pointer to the first element, although the two (array and & array) are consistent in values.
The addition and subtraction of the & array pointer is based on the entire array size, that is, the size of the array is 5, then & array + 2
Is to double the size of the entire array, that is, 0x7fff8423890 + 0x14*2;