//the setup
tiles = new Tile **[num_bands];
for( int i = 0 ; i < num_bands ; i++ )
tiles[i] = new Tile *[num_spokes];
for(int i=0; i < num_bands; i++){
for(int ii=0; ii < num_spokes; ii++){
tiles[i][ii] = 0;
}
}
//the problem
delete tiles[1][1];
When I delete a tile, tiles[1][1] still holds an address. I thought it should be a null pointer or 0x0, but its not. Am I deleting this wrong?
deleteisn’t supposed to null the pointer; it’s your own responsibility to do that if you want to.Basically,
deletejust means “I no longer need the memory at this address, so you can use it for something else.” – it doesn’t say anything about what value pointers that pointed to the freed address will have.