crashes at
Code:
unsigned int **save = new unsigned int *[rows+1];//increases the rows by 1
and I don't know why.
Code:
properTime = 0;
rows = 1;
obstacles = new unsigned int *[rows];
unsigned int i = 0;
//memory allocated for elements of each column.
for(unsigned int i = 0 ; i < rows ; i++)
obstacles[i] = new unsigned int[COLUMNS];
unsigned int timeOfCaging = whenCaged();
while(properTime < SECONDS_WORKED)
{
std::cout<<"no problem here"<<std::endl;
timeOfCaging = Drib::whenCaged();
obstacles[i][0] = timeOfCaging;
obstacles[i][1] = Drib::GetRandomNumber(0, TREE_HEIGHT-1);
std::cout<<"or here"<<std::endl;
//resize
unsigned int **save = new unsigned int *[rows+1];//increases the rows by 1
std::cout<<"right here"<<std::endl;
for(unsigned int j = 0; j < rows; j++){
for(unsigned int k = 0; k < COLUMNS; k++){//columns is equal to 2
std::cout<<"this"<<std::endl;
save[j][k] = obstacles[j][k];
std::cout<<"j: "<<j<<" k: "<<k<<" save[j][k]: "<<save[j][k]<<std::endl;
}
}
rows++;
delete [] obstacles;
obstacles = save;
properTime += whenCaged();
i++;
std::cout<<"at end of while loop"<<std::endl;
}
std::cout<<"exit here"<<std::endl;