2行の文字列入力を受け取り、画面に表示する単純なメイン関数をCで書きたいと思います。これは私が書いたコードです:
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;
}
コンパイルしようとすると、次のエラーメッセージが表示されます。
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]
助けてくれてありがとう