I'm creating an array dynamically, and I'm trying to catch it failing, though it doesnt seem to. Even though I give it absurd sizes. Am I doing something wrong?
1 2 3 4 5 6 7 8 9 10 11 12 13 14
int szInput;
cout << "How big do you want your array?\n";
cin >> szInput;
int *arr;
try{
arr = newint[szInput];
}catch(std::exception &e)
{
cout << "Error: " << e.what();
return 1;
}
cout << "Success";
EDIT:
I can get it to fail if I enter a negative number, but not if I enter some huge number. Is this normal behavior?