Variables can be divided into: global variables, static global variables, static local variables, and local variables. Press storage area, global variables, static global variables, and static local variables are stored in the memory-static storage area, and local variables are stored in the memory area. According to the role domain, the global variable is valid throughout the project file; the static global variable is only valid within the file defined; the static local variable is only valid in the defined function, but the program only assigns a memory, the function returns, This variable does not disappear; local variables are valid within the function of defining it, but the function returns to fail. Global variables and static variables are initialized by the compiler to 0 by the compiler if there is no manual initialization. The value of local variables is not known. The code is as follows: //test.cpp#include
//main.cppint a; int b = 10; void func2 () {static int i; i ; cout << i << endl;}
Void func1 ();
Void main () = 20; func1 (); func2 (); func2 ();} output is 52012