fork download
  1. #include <iostream>
  2. using namespace std;
  3. union Foo {
  4. unsigned char bytes[sizeof(short)];
  5. short value;
  6. };
  7.  
  8.  
  9. int main() {
  10. Foo foo;
  11. foo.bytes[0] = 0x70;
  12. foo.bytes[1] = 0xFE;
  13. bool isTrue = foo.value == -400;
  14. cout << foo.value;
  15. return 0;
  16. }
Success #stdin #stdout 0s 3456KB
stdin
Standard input is empty
stdout
-400