字符串名字和数组名字代表首地址也代表整个字符串或者数组;注意字符串名字和数组名字为地址,但她的类型为整个字符串或数组
问题:字符串和数组怎么在栈中存的呢?应该有个名字,存放了整个数组,但是名字又代表了第一个元素首地址。
char name[]={“abcde”};
char *fmt={“bgtda”};
int arr[]={1,2,3};
char *k=name;
char *p=&(*fmt);
int *i=arr;
printf("&name:%p\n",&name);
printf("&arr:%p\n",&arr);
printf("sizeof(int):%lu\n",sizeof(int));
printf("sizeof(long int):%lu\n",sizeof(long int));
printf("sizeof(unsigned int):%lu\n",sizeof(unsigned int));
printf("sizeof(long unsigned int):%lu\n",sizeof(long int));
printf("sizeof(nmae):%lu\n",sizeof(name));
printf("sizeof(fmt):%lu\n",sizeof(fmt));
printf("sizeof(arr):%lu\n",sizeof(arr));
printf("sizeof(k):%lu\n",sizeof(k));
printf("sizeof(p):%lu\n",sizeof(p));
printf("sizeof(i):%lu\n",sizeof(i));
return(0);