以下是错误:
main.c|188|error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token|
main.c|195|error: expected expression before '}' token|
main.c|195|error: expected expression before '}' token|
main.c|195|error: expected expression before '}' token|
||=== Build failed: 4 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|
这是我的代码中出现的部分,以及相应的行号: (我在Codeblocks上编译这个)
//If Option 4 is selected
if (input == 4) {
printf("You selected Option 4: Display all courses.\n");
for (int counter = 0, counter < 560000, counter++) { //line 188
course ToDisplay;
fread(&ToDisplay, sizeof(course), 1, in_file);
if (ToDisplay.dept != 000 && ToDisplay.num != 000) {
printf("%2s.%d.%d %d.%d ", ToDisplay.div, ToDisplay.dept, ToDisplay.num, ToDisplay.credits, ToDisplay.title);`
}
}
} //line 195
答案 0 :(得分:0)
在语句
中使用分号而不是逗号for (int counter = 0, counter < 560000, counter++) { //line 188
^^ ^^
否则编译器会考虑记录
int counter = 0, counter < 560000, counter++
作为多个变量(具有相同名称)的声明