The function of C language static static variableStatic
Variable type of C language
- Static variables are declared by the keyword static, which is stored on the data segment, which is memory, and can change the scope and life cycle of the variable.
- There is still no change to the local variable scope, only the function and compound statement that defines the local variable can be referenced, but its life cycle becomes until the end of the entire source program file.
- The global variable life cycle has not changed, but its scope has decreased, only the function of this file can reference the global variable.
- For the characteristics of static, only the function in this file can reference the variable, in C language a source program file is a module, a source program file (module) declares a static global variable The other module can only access this static variable through the interface functions provided by the module, and cannot directly implement it, that is, static can implement the encapsulation of a module.
The function of C language static static variable