fork download
  1. #include <stdio.h>
  2.  
  3. union Little_big {
  4. short int i; // 16 bit
  5. char c[2]; // 8 bit, 8 bit
  6. };
  7.  
  8. int main (void)
  9. {
  10. union Little_big lb;
  11. lb.i = 0x1234;
  12. printf ("%x %x%x\n", lb.i, lb.c[0], lb.c[1]);
  13. return 0;
  14. }
  15.  
Success #stdin #stdout 0.01s 1720KB
stdin
Standard input is empty
stdout
1234 3412