#include
#include
#define PRAISE "What a super marvelous name!"
int main(void)
{
char name[40];
printf("What's your name?\n");
scanf("%s",name);
printf("Hello,%s,%s\n",name,PRAISE);
printf("Your name of %d letters occupies %d memory cells.\n",strlen(name),sizeof name);
printf("The phrase of praise has %d letters",strlen(PRAISE));
printf("and occupies %d memory cells.\n",sizeof PRAISE);
return 0;
}
哪里出问题了,远行是说char name[40]这行错误
你中括号是中文格式的,char name[40];所以报错
scanf("%s",name);这个写法也是对的,楼上的说法我晕了。。。
貌似输入是这样的,
scanf("%s",&name);
是中括号的问题,scanf("%s",name) 里name 已经是地址了
printf("Your name of %d letters occupies %d memory cells.\n",strlen(name),sizeof name);
最后那里sizeof(name)