fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct split
  5. {
  6. uint32_t low;
  7. uint32_t high;
  8. };
  9.  
  10. int main() {
  11. split in;
  12. in.low = -3;
  13. in.high = 65;
  14.  
  15. uint64_t combined = *((uint64_t*)&in);
  16.  
  17. split& out = *((split*)&combined);
  18.  
  19. std::cout << (int) out.low << ", " << (int) out.high << std::endl;
  20.  
  21. return 0;
  22. }
Success #stdin #stdout 0s 3140KB
stdin
Standard input is empty
stdout
-3, 65