Static global variable: is the variable that can be used for methods in the current. M. Each time the call is invoked, the result of the last call is automatically used. Because only one memory address is allocated in the static allocation area, the numeric value is sliding scale.
Static local variables: the same as global variables, each time is automatically stored after the run value, the next time the runtime is directly used, but also only one address. is not released during the entire program run.
Dynamic local variables: often used, such as int a = 10, when a is a dynamic local variable. Each time the program is run to this place, a temporary allocation of an address, when the method is finished, the address is retracted, and the next time the method is called again, allocate a piece of memory.
Difference:
1. Assigning the initial value to a static local variable is done at compile time, that is, the initial value is assigned only once, and it has an initial value when the program is running. The initial value is not re-assigned each time the function is called, but at the end of the last function call.
Automatic variable assignment, not at compile time, but in the function call, each call function, re-give the initial value, equivalent to execute an assignment statement.
2. If the local variable is not assigned the initial value, for the static local variable, the compiler automatically assigns the initial value 0 (to the numeric type variable) or the null character (to the character type variable). In the case of an automatic variable, if the initial value is not assigned, it is an indeterminate value. This is because the storage unit has been disposed after each function call, and the next time it is called, the storage unit is reassigned, and the value of the allocated cell is indeterminate.
Static global variables, static local variables, dynamic local variables