Thi*_*ter 2 c initialization global-variables static-variables
可能重复:
C中静态变量的初始化
我知道全局变量或静态在C中自动初始化为零.但是,我不确定是否只有一个或者只有一个被初始化.请注意,我不是在讨论函数中定义的变量,而是在.c文件中全局讨论变量.
那么以下哪个变量会自动初始化为零?
static struct mystruct var1;
struct mystruct var2;
static struct { int x; int y; } var3;
Run Code Online (Sandbox Code Playgroud)