我有这么一个结构:
typedef struct
{
union{
int bytex[8];
int bytey[7];
}Value ;
int cod1;
int cod;
} test;
我想要初始化常量 test
如下:
const test T{
.Value.bytex = {0x11,0x22,0x33,0x44,0x11,0x22,0x33,0x44},
.cod1=0,
.cod=1,
};
我遇到了以下错误。
Expected primary-expression before '.' token
这个初始化是正确的:
const test T{
{0x11,0x22,0x33,0x44,0x11,0x22,0x33,0x44},
.cod1=0,
.cod=1,
};
你有什么想法吗?