Everything
11.1.3 Function calling

When a function in a file is called, if the definition of that function is not in the file or the function definition is included but the function is called before that function definition, it is recommended to declare the prototype of the function before the function is called.

This is because if the type of the parameters is unknown at the function call, there is a possibility that the compiler will call the function as a different type from the parameter type in the function definitionNote, and the execution result of the program will be invalid.

Note

An arithmetic type smaller than the int type or unsigned int type is treated as the int type, or the unsigned int type when it cannot be represented with the int type, and the float type is treated as the double type.
For others, see "(7) Default argument promotions".

Example 1.

Program with an incorrect execution result

AAA.c:
        void func(char a, char b);  //The two paramters receive their values from 
                                    //registers A and X
BBB.c:
        extern void func();         //Not a prototype declaration because the 
                                    //parameter types are not described
        void main (void)
        {
                char    x=1, y=1;
                func(x, y);         //After x and y are each extended to the int type 
                                    //and allocated to registers AX and BC, the 
        }                           //function call is made

Example 2.

Program with a correct execution result

AAA.c:
        void func(char a, char b);          //The two paramters receive their values 
                                            //from registers A and X
BBB.c:
        extern void func(char a, char b);   //Prototype declaration
        void main (void)
        {
                char    x=1, y=1;
                func(x, y);                 //After the two parameters are allocated 
        }                                   //to registers A and X, the function call 
                                            //is made

 

If compiler option "-refs_without_declaration" is specified, whether there is a function declaration can be checked.

If a function without a prototype is called, an error will occur.