First page Back Continue Last page Graphics

fig13_06.cpp (2 of 2) fig13_06.cpp output (1 of 1)

  • 25 // specify that customNewHandler should be called on failed
  • 26 // memory allocation
  • 27 set_new_handler( customNewHandler );
  • 28
  • 29 // allocate memory for ptr[ i ]; customNewHandler will be
  • 30 // called on failed memory allocation
  • 31 for ( int i = 0; i < 50; i++ ) {
  • 32 ptr[ i ] = new double[ 5000000 ];
  • 33
  • 34 cout << "Allocated 5000000 doubles in ptr[ "
  • 35 << i << " ]\n";
  • 36
  • 37 } // end for
  • 38
  • 39 return 0;
  • 40
  • 41 } // end main