• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include <stdint.h>
2 
3 union S
4 {
5     int32_t n;     // occupies 4 bytes
6     uint16_t s[2]; // occupies 4 bytes
7     uint8_t c;     // occupies 1 byte
8 };                 // the whole union occupies 4 bytes
9 
main()10 int main()
11 {
12   union S u;
13 
14   u.s[0] = 1234;
15   u.s[1] = 4321;
16 
17   return 0; // Break here
18 }
19