2

我收到以下错误:

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 的主要位置,第 41 行是编写它的位置。

4

1 回答 1

3

void RowCalc(char Country[][10],int medals[][3],float countave[],int numrow,int numcol);

您在 RowCalc 作为 Rowcal 的声明中有拼写错误

如上所述进行函数声明,以便您可以整齐地识别错误

于 2013-11-21T05:05:09.793 回答