开发者

how to place struct in union

I have an union X. It's size is 64bits. How can I write (if possible) its declaration if I want to access those 64 bits as:

 1. 4 int16_t: p,q,r,s;
 2. Array of 4 int16_t: a[4]
 3. 2 int32_t: n, m;
 4. Array of 2 int32_t: b[2]
 5. 1 int64_t z;
开发者_运维百科


something like

union thingie_type {
    struct { int16_t p,q,r,s; };
    int16_t a[4];
    struct { int32_t n,m; };
    int32_t b[2];
    int64_t z;
};
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜