fork download
  1. #include <iostream>
  2. #include <iomanip>
  3.  
  4. using namespace std;
  5.  
  6. struct Test
  7. {
  8. void * operator new[](size_t S)
  9. {
  10. cout << S << endl;
  11. cout << sizeof(Test) << endl;
  12. return nullptr;
  13. }
  14. };
  15.  
  16. int main(int argc, char * argv[])
  17. {
  18. Test * t = new Test[5];
  19. t = new Test[9];
  20. t = new Test[10];
  21. }
  22.  
Success #stdin #stdout 0.01s 5376KB
stdin
Standard input is empty
stdout
5
1
9
1
10
1