#include<stdio.h>
int main(void)
{
char a[]="sad";
printf("a=%p &a[0]=%p\n\n",a,&a[0]); //数组名a代表了数组首的地址,即为a[0]的地址,
printf("*a=%c a[0]=%c\n\n",*a,a[0]);
char *p="sad";
printf("p=%s *p=%c\n\n",p,*p);//*p代表对首数组地址解引用,即输出p[0];若要输出整个字符串,则不需要解引用
char ch[10];
printf("input: ");
scanf("%s",&ch[0]);
printf("ch=%s *ch=%c &ch[0]=%s\n\n",ch,*ch,&ch[0]);
scanf("%s",ch); //上下等价
printf("ch=%s *ch=%c &ch[0]=%s\n\n",ch,*ch,&ch[0]);
}
11-09
2055
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
10-16
148
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
01-21
3085
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
03-25
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交