类型兼容性约定和函数声明

时间:2014-04-07 16:48:23

标签: c types function-declaration

概念性问题。请考虑以下代码:

#include<stdio.h>

int brasa(int, float); 
int brasa(int, int); 
float brasa(int, int);

int main(){

return 0;
}

编译器出现以下错误:

Line 4: error: conflicting types for 'brasa'
Line 3: note: previous declaration of 'brasa' was here
Line 5: error: conflicting types for 'brasa'
Line 3: note: previous declaration of 'brasa' was here

那是什么消息? 另一个概念性问题:三个声明 all 是否声明了相同的函数?

1 个答案:

答案 0 :(得分:3)

在C语言中,您无法使用不同类型(不兼容的类型)声明变量/函数multiple times。与C ++不同,在C中没有函数重载。

相关问题