:mad: why want this work :(
map->LBottom= new TILE_STRUCT [tempheight][tempwidth];
Printable View
:mad: why want this work :(
map->LBottom= new TILE_STRUCT [tempheight][tempwidth];
It won't work because you can't allocate a two dimensional array like that. You have to allocate an array of pointers the size of the first dimension, and then for each pointer in the array, allocate memory for the second dimension.
You have to do the same (but backwards) for deleting the memory too, once you've finished with it.
you have to do somthing like this
map->LBottom = new TILE_STRUCT[height]
map->LBotoom = new TILE_STRUCT[height][width]
To allocate:To delete:Code:map->LBottom = new TILE_STRUCT[height];
for(int i = 0; i < height; i++) {
map->LBottom[i] = new TILE_STRUCT[width];
}
Code:for(int i = 0; i < height; i++) {
delete[] map->LBottom[i];
}
delete[] map->LBottom;