The scope and Storage Class of user identifiers in C Language (4 ).
4. Storage Classification of functions
All functions are external, because it is not allowed to define another function within the function. However, when defining a function, you can use the extern or static specifier.
4.1 Use extern to describe the function
When defining a function, if the specifier extern is added before the type returned by the function, this function is called an "external" function. The extern description can be omitted. General functions are implicitly described as extern. Therefore, all the previously defined functions belong to external functions.
External functions can be called by functions in other compilation units. Generally, when a function call statement is not in the same compilation unit as the called function, and the return value of the function is not an integer, use extern to describe the called function in the description section of the function where the call statement is located.
4.2 use static to describe functions
When defining a function, if the descriptive character static is added before the type returned by the function, the function is called a "static" function.
The characteristics of a static function are as follows: only other functions in the current compilation unit call it, and functions in other compilation units are not allowed to call it. In this sense, static functions can also be called "internal functions" (internal functions in this file ). Using static functions can avoid confusion caused by different compilation units because of the same name of the function. If a static function is forcibly called, an error message is generated.