fork download
  1. #include <iostream>
  2.  
  3. #pragma pack (push, 1)
  4. struct Struct {
  5. bool f1;
  6. bool f2;
  7. bool f3;
  8. bool f4;
  9. bool f5;
  10. };
  11. #pragma pack (pop)
  12.  
  13. using ArrayBool = bool[sizeof(Struct)];
  14.  
  15. int main() {
  16. Struct Bool = {true, true, false, false, true};
  17. for(const auto &i : *(reinterpret_cast<ArrayBool*>(&Bool))) std::cout << i << std::endl;
  18. return 0;
  19. }
Success #stdin #stdout 0s 16064KB
stdin
Standard input is empty
stdout
1
1
0
0
1