我在结构中看到了一些联合声明,如下所示。下面给出的示例代码。
我的问题是它是否有助于节省内存(联合用于的典型用途)?我没有看到好处。
typedef struct
{
int x1;
unsigned int x2;
ourstruct1 ov1;
ourstruct1 ov2;
union
{
struct
{
mystruct1 v1;
mystruct2 v2;
mystruct3 v3;
int* ctxSC;
mystruct4 v4;
Bool v5;
Long v6;
Long v7;
Long v8;
Long v9;
}mystr;
};
}structvar1;
-广告