https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86668
Bug ID: 86668 Summary: mixing ansi prototype with K&R definition Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: amrosalem820 at gmail dot com Target Milestone: --- I mix ansi prototype with K&R definition ,, I know it will be an error if the parameters of the ansi form aren't compatible with the default promotions .. my problem is when I wrote the ansi prototype outside main it compiled well !! //this program compiled well int fun (float x) ; int main () { fun (5.0); } int fun (x) float x ; { return x ; } but when I wrote it inside main it gave an error as expected //this program didn't compile and gave error "conflicting types for fun" int main () { int fun (float x) ; fun (5.0 ); } int fun (x) float x ; { return x ; } why there is difference between writing prototype inside main or outside main in this case ?