在 C 语言中,是否可以在另一个 union 体中定义一个 union 体?如果不是,为什么不可能?或者如果可以,可以在哪里使用?
最佳答案
假设您要定义:
union myun {
int x;
sometype y;
};
其中 sometype
是由您正在使用的库定义的 typedef
。如果库碰巧将其实现为 union 类型,那么这将是 union 中的 union ,并且这是有意义的,因为您不能(从良好的设计角度来看)违反库类型的封装。
关于c - union 内的 union ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49445782/