我不知道下面的代码有什么问题。也许scanf_s
不会扫描字符串名称。
int main(void)
{
char *name[20];
printf("What is your name>");
scanf_s("%s", name);
printf("Your name is %s\n", name);
return 0;
}
我改变了它,但它仍然不起作用:
char *name[20];
{
printf("What is your name>");
scanf_s("%19s", name);
printf("Your name is %s\n", name);
return 0;
}
是的,以下工作谢谢!!!!!!!
int main(void)
{
char *name[20];
printf("What is your name>");
scanf_s("%s", name, 20);
printf("Your name is %s\n", name);
return 0;
}