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