Function declarations
A function identifier preceded by its return type and followed by its parameter list is called a function declaration or function prototype. The prototype informs the compiler of the format and existence of a function prior to its use. The compiler checks for mismatches between the parameters of a function call and those in the function declaration. The compiler also uses the declaration for argument type checking and argument conversions.
Implicit
declaration of functions is not allowed: you must explicitly declare
every function before you can call it.
If
a function declaration is not visible at the point at which a call
to the function is made, the compiler assumes an implicit declaration
of extern int func(); However, for conformance to
C99, you should explicitly prototype every function before making
a call to it.
- Function storage class specifiers, which specify linkage
- Function return type specifiers, which specify the data type of a value to be returned
- Function specifiers, which specify additional properties for functions
- Function declarators, which include function identifiers as well as lists of parameters
All function declarations have the form:
Function declaration syntax >>-+-------------------------+--+--------------------+----------> '-storage_class_specifier-' '-function_specifier-' >--return_type_specifier--function_declarator--;---------------><
Note: When function_declarator incorporates a trailing return type,
return_type_specifer must be auto. For more information about
trailing return type, see Trailing return type (C++11).
In addition, for compatibility with C++, you can use attributes to
modify the properties of functions. They are described in Function attributes.