hello.c: In function 'All': hello.c:6:15: error: 'N' undeclared (first use in this function) for(i=0;i
----------------------------------------------------
#include <stdio.h>
int All(int score[])
{
int all=0;
int i;
for(i=0;i<N;i++)
{
all+=score[i];
}
return all;
}
int main()
{
int sum;
sum=All(score);
int score[N]={67,98,75,63,82,79,81,91,66,84};
printf("%d",sum);
return 0;
}
你没有定义N的值
解决方法:
①定义N为10:#define N 10
②把N改成10,
int score[10]={67,98,75,63,82,79,81,91,66,84};
for(i=0;i<10;i++)