【发布时间】:2018-04-06 17:57:27
【问题描述】:
考虑以下代码:
void func()
{
int p;
...
if (p > MAX) {
struct my_struct s;
...
/* here we access the contents 's' as '&s' */
}
}
在这个 sn-p 中,s 在堆栈上。是否保证编译器将所有结构字段初始化为零?
【问题讨论】:
-
绝对不是。
c中的自动存储没有进行自动初始化
标签: c struct initialization automatic-storage