i dont know why but in specific test that i run on my code the program crushed.
that heppens while the program releases the memory of 2d dynamic array.
i checked the program hundreds of times but I can not understand what the problem is.
I know that usually this happens when trying to reach memory that is not allocated but it is not the case.
//===================================================================
//function that releases the memory in the end of the program
//------------------------------------------------------------------
void release_final(int **&arr,int limit)
{
int loop=0;//looping variable
for (loop=0;loop<limit;loop++)
delete[] arr[loop];
delete[] arr;
}
Looks like you are deleting an item in the array and than the whole array on the first
execution of your loop. Than the loop keeps going and trying to delete more items from the array but the array has already been deleted.
But delete [] arr is already outside the loop.
There are no { } in the loop.
More than that, i run 10 tests but the problem is just in one test...
According to what you said the problem should be in all the tests...