[Programming] Introduction to C++: When will the static global area (static area) be released?

When will the static global area (static area) be released?

  1. Static local variables always exist when the program starts to execute, which means that its lifetime is the entire source program.
  2. Although the lifetime of a static local variable is the entire source program, its scope is still the same as that of an automatic variable.
  3. The initialization of static local variables is carried out at compile time. Use constants or constant expressions for assignment during definition. The system automatically assigns a value of 0 when it is not assigned
  4. Static local variables are inheritable.

Guess you like

Origin blog.csdn.net/m0_46613023/article/details/114523624