我已经看到一些结构内部的联合声明如下。下面给出了示例代码。工会声明C代码
我的问题是否有助于节省内存(使用联合使用的典型用途)?我没有看到好处。
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;
〜AD
去我的问题那里你可以看到联盟和结构的最佳使用 http://stackoverflow.com/questions/252644/why-this-union-is-deleting-the-1st-records-in-arrays -in-the-c-code – 2008-10-31 06:04:21