#include <stdio.h>
typedef struct
{
int as;
int bs;
int cs;
}asd_t;
typedef struct
{
asd_t asd[10];
}asd_field_t;
typedef struct
{
int a;
int b;
asd_field_t asd_field[10];
}abc_t;
int main()
{
abc_t abc ={0,1,{0}};
return 0;
}
在上面的代码中,我试图初始化结构abc_t
。将上面的代码编译为:
gcc -Wall sample.c
给我:
sample.c: In function 'main':
sample.c:26: warning: missing braces around initializer
sample.c:26: warning: (near initialization for 'abc.asd_field[0].asd')
如何避免此警告?