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.
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. |
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.