Trap for calculating the array name and address calculation should be noted to directly look at the code: # includeintmain () {intarray [5]; printf (array: % p \ n, array ); printf (array + 2: % p \ n, array + 2); printf (& amp; array + 2: % p \ n, & am
"Trap" should be noted when calculating the array name and address"
View the code directly:
# Include
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;