いくつかの問題を解決するのを手伝ってください。
ファイルには次が含まれます。
AAAA 111 BBB
CCC 2222 DDDD
EEEEE 33 FF
コードは次のとおりです。
int main() {
FILE * finput;
int i, b;
char a[10];
char c[10];
finput = fopen("input.txt", "r");
for (i = 0; i < 3; i++) {
fscanf(finput, "%s %i %s\n", &a, &b, &c);
printf("%s %i %s\n", a, b, c);
}
fclose(finput);
return 0;
}
コードは機能します。ただし、次のエラーが発生します。
format «%s» expects argument of type «char *», but argument 3 has type «char (*)[10]
format «%s» expects argument of type «char *», but argument 5 has type «char (*)[10]
種類が間違っていませんか?どうしたの?