Here's another look at what's different for arrays A,a and &a
1#include <stdio.h>2 3 voidChange_array (Char*,int);4 5 intMainvoid)6 {7 Chara[Ten] ="ABCDEFG";8printf"&the address of origin a =%p\n",&a);9printf"A1:%p\n", a); Tenprintf"sizeof (&a):%d\n",sizeof(&a)); Oneprintf"sizeof (a)%d\n",sizeof(a)); AChange_array (A,Ten); -printf"&the Address of later a =%p\n",&a); -printf"A2:%p\n", a); theprintf"%s\n", a); - return 0; - } - + voidChange_array (Char*a,intN) - { +scanf"%s", a);//to my surprise, this gets the same result as using either a or &a. Aprintf"arraysizeof (&a):%d\n",sizeof(&a)); atprintf"arraysizeof (a):%d\n",sizeof(a)); -printf"&array:%p\n", &a); -printf"array1:%p\n", a); - } - - /*************************************************** in * &the address of origin a = 0x7ffee2cdd0a0 - * a1:0x7ffee2cdd0a0 to * sizeof (&A): 8----------> In this case, &a corresponding byte is 8, in my Computer, the pointer p address (&P) to get the size is also 8 + * sizeof (a)----------the corresponding byte of >a is 10, indicating that the size of a is a[10], that is, the size of the array. - * xxxx the * arraysizeof (&a): 8----------> here is 8, no doubt, indicating the pointer size is 8 * * Arraysizeof (a): 8---------------------->>>>>>>>>> Here's a question. Put your face down and say!!! $ * &array:0x7ffee2cdd088Panax Notoginseng * array1:0x7ffee2cdd0a0 - * &the Address of later a = 0x7ffee2cdd0a0 the * a2:0x7ffee2cdd0a0 + * xxxx A * *************************************************/Then the code in 35 lines: through the above output, we know that the Mian in the array A and the Array_change in the array a address is the same! That is 0x7ffee2cdd0a0, note A and & A is different. So why is sizeof (a) in main the size of 10 bytes, and sizeof (a) in Array_change is only 8 bytes in size? It is verified that when the array name is passed as a parameter, only the array address is passed. Does not pass the size of the array together, so we need to define another parameter to pass the array size.