fork download
  1. #include <stdio.h>
  2.  
  3. struct MyStruct
  4. {
  5. unsigned int bytes0 : 8;
  6. unsigned int bytes1 : 8;
  7. unsigned int bytes2 : 8;
  8. unsigned int bytes3 : 8;
  9. };
  10.  
  11. int main()
  12. {
  13. struct MyStruct mys = {0x12, 0x34, 0x56, 0x78};
  14. unsigned char *array = (unsigned char *)&mys;
  15. printf("%02x %02x %02x %02x\n", array[0], array[1], array[2], array[3]);
  16.  
  17. return 0;
  18. }
  19.  
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
12 34 56 78