我在编译代码时遇到了两个错误,但我无法确定问题所在。请问有人能帮忙解决吗?
error: old-style parameter declarations in prototyped function definition
error: 'i' undeclared (first use in this function)
代码:
void printRecords (STUREC records[], int count)
STUREC records[ARRAY_MAX];
int count;
int i;
{
printf("+---------------------------+--------+--------+--------+--------+--------+--------+---------+-------+\n");
printf("| Student Name | ID | Test 1 | Test 2 | Proj 1 | Proj 2 | Proj 3 | Average | Grade |\n");
printf("+---------------------------+--------+--------+--------+--------+--------+--------+---------+-------+\n");
for (i = 0; i < count; i++)
{
size_t j;
printf ("|%s|%d|%d|%d|%d|%d|%d|%f|%c|", records[i].name, records[i].id, records[i].score1,
records[i].score2, records[i].score3, records[i].score4, records[i].score5,
records[i].ave, records[i].grade);
}
return;
}
{
括号。 - jboockmann{
应该跟随函数参数列表。 - Eugene Sh.void printRecord (STUREC records[], int count)
后面跟着一个局部声明的int count;
...这两行是错误代码指向的地方,但我都将它们声明为int类型,那么错误可能是指什么呢? - champlooSIXSIX