Are the members of a global structure initialized to zero by default in C?

后端 未结 5 1780
星月不相逢
星月不相逢 2020-12-04 22:21

Are the members of a global or static structure in C guaranteed to be automatically initialized to zero, in the same way that uninitialized global or static variables are?

5条回答
  •  旧时难觅i
    2020-12-04 22:42

    Yes, all global data is zeroed out, including the members of structures, classes and unions.

提交回复
热议问题