fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct X {
  5. int a;
  6. int b;
  7. };
  8.  
  9. int main() {
  10. int foo[2];
  11. X* p = reinterpret_cast<X*>(foo);
  12.  
  13. p->a = 1;
  14. p->b = 2;
  15. cout << p->a << ' ' << p->b << endl;
  16. }
Success #stdin #stdout 0s 4564KB
stdin
Standard input is empty
stdout
1 2