C Language Study Notes: 14_internal and external functions
/** 14 _ internal and external functions. c ** Created on: July 15, July 5, 2015 * Author: zhong */# include
# Include
/*** The so-called internal function is differentiated based on whether the function can be called by other sources. * 1: internal function: add a static function before Function Definition (this static function in C language is too far away from the static method in java) * If a function can only be called by other functions in this file, it is called an internal function, or a static function *. You only need to add a static keyword before the definition and function. In this case, you can restrict the scope of the function to this file. The effect is the same as that of the java private method. * For example, static int max (int a, int B) {} * not only limits the scope, but also allows you to define function names with the same name in different files in the same project, mutual interference ** 2: external functions: add an extern before the function definition. Of course, this extern keyword can be omitted, that is, the ordinary default function set at ordinary times * such: extern int fun (int a, int B) {}** when calling external functions of other files in this file, external function declaration is required (of course, the function prototype must be declared for calls in this file ). When declaring this function, add the keyword extern ***** // defines the internal function (static function) static int max _ (int a, int B) {return a> B? A: B;} // normal function (external function) extern int fun () {// extern can be omitted} int main () {extern void character_int_out_put (); // reference the "02 _ input/output function. c "file function, first declare it, Do not warn, but do not report character_int_out_put (); // call // system (pause); return 0 ;}