我想在C中编写一个简单的main函数,它接收两行字符串输入并在屏幕上打印它们.这是我写的代码:
int main()
{
char a[100];
char b[100];
printf("Enter the first string:\n");
fgets(a,100,stdin);
printf("Enter the second string:\n");
fgets(b,100,stdin);
printf("\n\n THE FIRST STRING IS: %S\n\n THE SECOND STRING IS:%S",a, b);
return 0;
}
Run Code Online (Sandbox Code Playgroud)
当我尝试编译时,我收到此错误消息:
gcc -g -Wall PN52.c -o myprog
PN52.c: In function ‘main’:
PN52.c:12:2: warning: format ‘%S’ expects argument of type ‘wchar_t *’, but argument 2 has type ‘char *’ [-Wformat]
PN52.c:12:2: warning: format ‘%S’ expects argument of type ‘wchar_t *’, but argument 3 has type ‘char *’ [-Wformat]
Run Code Online (Sandbox Code Playgroud)
谢谢你的帮助
| 归档时间: |
|
| 查看次数: |
475 次 |
| 最近记录: |