fork(1) download
  1. #include <stdio.h>
  2. #include <stdint.h>
  3.  
  4.  
  5. union myByte{
  6. uint8_t BYTE;
  7. struct {
  8. unsigned BIT0:1;
  9. unsigned BIT1:1;
  10. unsigned BIT2:1;
  11. unsigned BIT3:1;
  12. unsigned BIT4:1;
  13. unsigned BIT5:1;
  14. unsigned BIT6:1;
  15. unsigned BIT7:1;
  16. }BIT;
  17. };
  18.  
  19. union myAccess {
  20. uint16_t access16;
  21. struct {
  22. uint8_t lo;
  23. union myByte hi;//here
  24. } access8;
  25. };
  26.  
  27. int main()
  28. {
  29.  
  30. union myAccess U;
  31. U.access8.lo=0xF1;
  32. U.access8.hi.BYTE=0x55;
  33. printf("%x\n",U);
  34.  
  35.  
  36.  
  37. return 0;
  38. }
Success #stdin #stdout 0s 2248KB
stdin
Standard input is empty
stdout
f1