First, external functions
- External functions: If the function defined in the current file allows other files to be accessed, called, is called an external function. The C language stipulates that external functions with the same name are not allowed
Second, internal function
- intrinsic function: If the function defined in the current file does not allow other files to be accessed, invoked, or used internally, it is called an intrinsic function. The C language specifies that different source files can have intrinsic functions with the same name and do not interfere with each other.
Iii. Summary of static, extern and function
1. When defining a function, add static at the leftmost side of the function to declare the function as an intrinsic function (also called a static function) so that the function can only be used in the file where its definition resides. If there are intrinsic functions of the same name in different files, they do not interfere with each other.
2.static can also be used to declare an intrinsic function
3. When defining a function, if you add the keyword extern to the leftmost side of the function, it means that the function is an external function that can be called by other files. The C language specifies that if you omit extern when defining a function, it is implied as an external function.
4. In a file to invoke the external functions in other files, you need to declare the external function in the current file with extern, and then you can use, where the extern can also be omitted.
5..extern can be used to declare a global variable, but it cannot be used to define a variable
6. By default, a global variable can be shared by multiple source files, which means that a global variable with the same name in multiple source files represents the same variable
7. If you add the static keyword when defining a global variable, the effect of static is to limit the scope of the global variable, to be used only in the file that defines the global variable, and not to interfere with the same name variable in other source files
Iv. Summary of typedef
1. We can use the TypeDef keyword to define a new name (alias) for various data types.
2. You can also alias the alias based on another
typedef int INTEGER;TYPEDEF Integer Myinteger;
3. The typedef can alias the pointer, except that it can alias the base data type
4. By default, we define struct variables that require a struct keyword
5.typedef can alias pointers, structs, and, of course, pointers to struct bodies.
6. Using typedef to alias an enumeration type can also make the code concise.
7. To alias a type later, it is best to use typedef instead of # define
Dark Horse programmer--c Language Basic Grammar Knowledge (iv)