哪里有錯誤?
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;
}
2019-11-02
你沒有定義N的值
解決方法:
①定義N為10:#define N 10
②把N改成10,