#include <iostream> #include <new> using namespace std; int main() { int *p; try { p = new int (87); // initialize to 87 } catch (bad_alloc xa) { cout << "Allocation Failure\n"; return 1; } cout << "At " << p << " is the value " << *p << "\n"; delete p; return 0; }
At 0x3d2448 is the value 87