fork download
  1. #include <iostream>
  2. #include <limits.h>
  3. using namespace std;
  4.  
  5. struct type_t {
  6. int a;
  7. int b;
  8. };
  9.  
  10. int main() {
  11.  
  12. const int x(5000), y(5000), z(5000);
  13.  
  14. type_t*** a;
  15.  
  16. /* L1 Alloc */
  17. a = new(nothrow) type_t** [x];
  18. if( a == nullptr ) cerr << "Error at L1!" << endl;
  19.  
  20. /* L2 Alloc */
  21. for( int i = 0; i < x; i++) {
  22. a[i] = new(nothrow) type_t* [y];
  23. if( a[i] == nullptr ) {
  24. cout << "Error at L2!" << endl;
  25. abort();
  26. }
  27. }
  28.  
  29. /* L3 Alloc */
  30. for( int i = 0; i < x; i++) {
  31. for( int j = 0; j < y; j++) {
  32. a[i][j] = new(nothrow) type_t [z];
  33. if( a[i][j] == nullptr ) {
  34. cout << "Error at L3!" << endl;
  35. abort();
  36. }
  37. }
  38. }
  39.  
  40. return 0;
  41. }
Runtime error #stdin #stdout 0.06s 1043456KB
stdin
Standard input is empty
stdout
Error at L3!