fork download
  1. #include <iostream>
  2. #include <new>
  3.  
  4. using namespace std;
  5. struct Int{
  6. int x;
  7. };
  8.  
  9. int main() {
  10. char buf1[10] = "xxxxxxxxx";
  11. char buf2[10] = "xxxxxxxxx";
  12. Int * px1 = new(buf1) Int();
  13. Int * px2 = new(buf2) Int;
  14. cout << "One=" << px1->x << ". Two=" << px2->x << endl;
  15.  
  16. return 0;
  17. }
Success #stdin #stdout 0s 2852KB
stdin
Standard input is empty
stdout
One=0. Two=2021161080