联合体可以在声明中初始化吗?
例如,假设我们有一个 union,
typedef union {
unsigned long U32;
float f;
}U_U32_F;
当声明这个 union 类型的变量时,有没有办法设置一个初始值?
U_U32_F u = 0xffffffff; // Does not work...is there a correct syntax for this?
For example, say we have a union
typedef union {
unsigned long U32;
float f;
}U_U32_F;
When a variable of this union type is declared, is there a way to set an initial value?
U_U32_F u = 0xffffffff; // Does not work...is there a correct syntax for this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

发布评论
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
使用初始值设定项列表:
您可以通过以下方式设置第一个成员之外的其他成员
Use an initializer list:
You can set other members than the first one via