I have been getting the following errors:

c:41:6: warning: conflicting types for ‘RowCalc’ [enabled by default]
c:14:2: note: previous implicit declaration of ‘RowCalc’ was here

I have looked over the function from the declaration to the call the the function itself many times and I still cant figure this out.

#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

row 14 is in main where RowCalc is called and 41 is where it is written.

有帮助吗?

解决方案

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

There's a spelling mistake in your declaration on RowCalc as Rowcal

Make the function declaration as above so that you can identify the error neatly

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top