用指针输出字符串为什么不能是*a
#include<stdio.h>void main()
{
char str;
char *a;
printf("please input the domain name of fishc\n");
a=&str;
scanf("%s",a);
printf("the domain name of fishC is :%s\n",a);
}
为什么最后一行printf("the domain name of fishC is :%s\n",a);
以字符串形式输出不能写成这样printf("the domain name of fishC is :%s\n",*a);呢? 因为 %s 要一个地址,a是一个地址,*a是一个字符
页:
[1]