我收到以下错误:
c:41:6: warning: conflicting types for ‘RowCalc’ [enabled by default]
c:14:2: note: previous implicit declaration of ‘RowCalc’ was here
我已经多次查看函数从声明到调用函数本身的过程,但我仍然无法弄清楚这一点。
#include <stdio.h>
void ReadD(char[][10],int[][3]);
void RowCal(char[][10], int[][3], float[], int, int);
void ColCalc(int[][3], float[], int, int);
int main()
{
char Country[11][10];
int medals[11][3], numrow=11, numcol=3;
float medave[3], countave[11], contave[2];
ReadD(Country, medals);
RowCalc(Country,medals,countave,numrow,numcol);
return 0;
}
void ReadD(char Country[][10], int medals[][3])
{
int r, c, test;
for(r=0;r<11;r++)
{
printf("Enter Country");
scanf("%s", Country[r]);
printf("Enter Medals won");
for(c=0;c<3;c++)
{
scanf("%d", &medals[r][c]);
}//end of for c
}//end of for r
}//end of ReadD
void RowCalc(char Country[][10],int medals[][3],float countave[],int numrow,int numcol)
{
int r, c, countsum[11]={0,0,0,0,0,0,0,0,0,0,0};
printf("Country \t medals \t Country average\n");
for(r=0;r<numrow;r++)
{
printf("%s \t", Country[r]);
for(c=0;c<numcol;c++)
{
printf("%d \t", medals[r][c]);
countsum[r]+=medals[r][c];
}//end of for c
countave[r]=(float)countsum[r]/numcol;
printf("%f\n",countave[r]);
}//end of for r
}//end of RowCalc
第 14 行是调用 RowCalc 的 main 行,第 41 行是写入它的位置。
最佳答案
void RowCalc(char Country[][10],int Medals[][3],float countave[],int numrow,int numcol);
您在 RowCalc 上将其声明为 Rowcal 时存在拼写错误
按照上面的方式进行函数声明,以便您可以清楚地识别错误
关于c - 警告 : conflicting types error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20112851/