(2) Although the lifetime of a static local variable is the whole source program, its scope is still the same as that of an automatic variable, that is, it can only be used in the function that defines the variable. After exiting the function, although the variable still exists, it cannot be used.
(3) It is allowed to assign an initial value to the static local quantity of the structure. If no initial value is specified, the system will automatically specify a value of 0.
(4) If the initial value is not assigned to the static local variable of the basic type, the system will automatically assign a value of 0. However, if an automatic variable has no initial value, its value is uncertain. According to the characteristics of static local variables, we can see that it is a quantity whose lifetime is the whole source program. Although you can't use it after leaving the function that defines it, you can continue to use it when you call the function that defines it again, and save the value left after the last call. Therefore, static local variables can be considered when a function is called many times and it is required to keep the values of some variables between calls. Although global variables can also achieve the above objectives, global variables sometimes cause unexpected side effects, so it is appropriate to use local static variables.