Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个联合 X。它的大小是 64 位。如果我想访问这些 64 位,我该如何编写(如果可能)它的声明:
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;
就像是
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; };