问题第二部分的简化解释:-
1.Auto variables are stored in stack segment.
2.Uninitialized global variables are stored in BSS segment.
3.Initialized global variables and global static variables are stored in data segment.
***4.Local static variables are stored in data segment of the memory.***
变量的范围和生命周期
自动变量
Scope:- Only the function in which it is declared
Lifetime:- From when control enters the function in which it is declared till when control exits the function
全局变量
Scope:- Global variables can be accessed from anywhere in the program
Lifetime:- Entire life of program execution
全局静态
Scope:- Global static variables can be accessed from anywhere inside the file in which they are declared
Lifetime:- Entire life of program execution
局部静态
Scope:- Local static variables can be accessed inside the function where it is declared
Lifetime:- Entire life of program execution