// bad_alloc example #include // cerr #include // bad_alloc // #include // bad_alloc also in here using namespace std; int main () { try { int* myarray= new int[10000000000000000]; } catch (bad_alloc& ba) { cerr << "bad_alloc caught: " << ba.what() << '\n'; } return 0; }