【发布时间】:2018-10-24 14:44:22
【问题描述】:
我有这个结构:
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,
};
你有什么想法吗?
【问题讨论】: