464 views
1 votes
1 votes

1 Answer

Best answer
2 votes
2 votes

C doesnot support function overloading. So when you do extern int fun(float); in main, it assumes there is a function which is 'int fun(float)' in the program. Now it comes across another function 'int fun(int bb)', it considers it as another function which has the same name as the previous extern function.

Since there is no same name function overloading support in C, it throws an error "conflicting types for ‘fun’ int fun(int bb); previous declaration of ‘fun’ was here extern int fun(float);"

If you replace int fun(int bb) with int fun(float bb), it works. 

Also, I assumed in the printf of main, it is printing b and not a.

selected by

No related questions found