Here is the relevant code:
The boundariesCode:string getVal(vector<vector<string>> * matrix, int row, int col)
{
row--;//account for offsets
col--;
try
{
if(row >= 0 && col >= 0 && col < cols && row < rows)//make sure it is inbound
return (*matrix)[row][col];
else
throw "Out of Bounds Error!";
}
catch (const char * ex)
{
cout << "\n*** " << ex << " ***" << endl;
}
}
cols is 4
rows is 4
and row is 5, col is 3
It catches the error and prints out *** Out of Bounds Error!***
but then a window pops up saying
Unhandled exception at 0x62907a8b ...
Access violation reading location 0xc0e8013e
I am running this in MS visual studio 2008