c - 警告 : conflicting types error

标签 c function compiler-errors function-declaration

我收到以下错误:

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/

相关文章:

c - ncurses 中的 nodelay() 和 cbreak() 有什么区别?

javascript - 将动画添加到 RaphaelJS 切换函数

c# - 如何在调用构造函数之前初始化 F# 中的字段?

C++ g++ 在类头文件中找不到 'string' 类型

c++ - Cygwin不会编译任何C++文件

c++ - 如何使概念失败并显示自定义错误消息(C++ 20)

c++ - 目录结构 C++

c - 失效进程,fork()

c - 为什么我的 "=r"(var) 输出没有选择与 "a"(var) 输入相同的寄存器?

function - Python 3 的 new.function 替换