Original Post
... i basically want to allocate space for a 2 dimensional array but it seems i can''t, this does not work
int *p;
int x = 10;
int y = 10;
p = new int [x][y];
of course i can just go p = new int [x * y] ... however in my case i later need to acces like p[8][4], or p[2][6] ... and multiply them together like p[8 * 4] obviosly doesnt work since that will be the same value as p[4][8] ... so can i not dynamically allocate 2 dimensional arrays? or am i doing something wrong?
if i cant however, how can i solve this problem ... i have a map class which basically has all the variables and functions for operating a 2d tile map ... that variables that holds the data for each cells needs to be an array, but i do not want to give the array bounds since i want to be able to only allocate the exact space for how large each map i load is. so i need to be able to allocate space for the variable and then be able to access it similar to the fashion like map[1][2] would be 1 tile right and 2 down and map[2][3] would be 2 tiles .... etc, can i do this withough setting a predefined array boundries and without using the vector class ... maybe i should do this with linked lists?
thanks for any help in advance.