How to make GCC warn unmatched number of arguments in function calls and function definition?

I have two files.

The first file contains the function prototype and the main function calls myfunc with only one argument:

int myfunc (int x);
int main ()
    int x =5;

and the second file contains the function definition but with 2 arguments:

int myfunc (int x, int y)
        return x+y;

When I tried to compile this two files using GCC I got no errors or warnings.

How to force GCC to warn about something like this??

Source: gcc

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.