문제

Conceptual question. Consider the following code:

#include<stdio.h>

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

int main(){

return 0;
}

The compiler gives the following errors:

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

Which kind of message is that? Another conceptual question: do the three declarations all declare the same function?

도움이 되었습니까?

해결책

In C you can't declare a variable/function multiple times with different types (incompatible types). There is no function overloading, unlike in C++, in C.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top