fork download
  1. #include <iostream>
  2.  
  3. struct pair_of_short
  4. {
  5. short first, second;
  6. };
  7.  
  8. const pair_of_short p = reinterpret_cast<const pair_of_short&>(static_cast<const long&>(42));
  9.  
  10. int main()
  11. {
  12. std::cout << p.first << ", " << p.second << std::endl;
  13. }
Success #stdin #stdout 0s 4524KB
stdin
Standard input is empty
stdout
42, 0