The visibility of the variable (that is, the scope) and the life period are both distinct and related.
A variable has no visibility at some point in the program, but the lifetime can exist, for example, the visibility of a local static variable in its function, outside the function is not accessible, but it is the lifetime of the entire program is running, and a variable lifetime end, it also has no visibility, like local variables, As the stack space is released, it does not exist, so it cannot be accessed externally.
Determining the visibility of a variable is where the variable is declared (just like a local static variable, because it is declared within a function, it can only be seen within a function, and the life of a variable is determined by its position in memory (as if the static local variable is not allocated on the stack, but is allocated in the memory-static storage area, Therefore the life period is also different from ordinary local variables.