====== C - C++ Exception Handling - bad_alloc Exceptions ====== #include using std::cout; using std::bad_alloc; int main() { int* p[10]; try { for ( int i = 0; i < 10; i++ ) { p[ i ] = new int[2]; cout << "\nAllocated successfully"; } } catch ( bad_alloc &memoryAllocationException ) { cout << "Bad allocation " << memoryAllocationException.what() ; } return 0; }