Local Variables
definition: A variable defined inside a code block
scope: Start with the line that defines the variable until the end of the code block
life cycle: Allocates storage space from the row that defines the variable, which is recycled when the code block ends
No default initial value
Global Variables
definition: A variable defined outside a function
scope: Starts at the line that defines the variable and ends at the end of the file (can be shared by all subsequent functions)
life cycle: When a program starts, it allocates storage space and is destroyed when the program exits.
The default initial value is 0
Global variables are divided into external variables and internal variables
External variables: defined variables can be accessed by this file and other files, by default all global variables are external variables
Internal variables: defined variables can only be accessed by this file and cannot be accessed by other files
intrinsic functions: Defined functions can only be used in this file, other files cannot be accessed
allow intrinsic functions with the same name in different files
External functions: Defined functions can be accessed by other files
By default, all functions are external functions
external functions with the same name are not allowed
Static and the extern
valid for both functions and variables
static defines and declares intrinsic functions, defines an internal variable
Static modifies local variables, extends the life cycle of local variables, is destroyed at the end of the program, and does not change the scope of local variables
extern defines and declares an external function, declares an external variable
Review summary of C language, global variables, local variables, external functions, intrinsic functions, stasic and extern