I am having this piece of code:
try
{
int* myTestArray = new int[2];
myTestArray[4] = 54;
cout << \"Should throw ex \" << myTestAr
Accessing unallocated memory is not guaranteed to throw exceptions.
It's actually not guaranteed to do anything, since that's undefined behavior. Anything could happen. Beware of nasal demons.
It prints 55 because you just stored 54, fetched it back and then printed 54+1. It's not at all guaranteed to print 55, although that's often what will happen in practice. This time it worked.