The discovery of this problem is found in the following code:
#include <stdio.h>int main () {int arr[2]={1,2}; printf ("%p", arr); printf ("%p", &arr); return 0;}
After running, we find that the address of the array name itself and the address of the group name are stored exactly the same, we understand the array name as a const pointer (the array name can only be used as an rvalue, not an lvalue), and what is &arr?
I tried to add the following code to the previous code:
printf ("%p\n", arr+1); printf ("%p\n", (&arr) +1);
It is found in the display window that this shift operation by pointers is more peculiar:
The first one is shifted according to an int size.
The second one is shifted according to a sizeof (a).
This shows that, first of all, they are pointers, the pointer has two parts, one is the stored type, and the other is the address of the memory, above the actual phenomenon that ARR itself is a pointer to the first element of the array, whose pointer type is int*, the second pointer to the operation of the address is a type of int[2]* The pointer.
A freshman who has just entered this field, if there is a mistake, many advice.
This article is from the "12040732" blog, please be sure to keep this source http://12050732.blog.51cto.com/12040732/1883389
The address of the array name, and the discussion of the address of the group name