   multi-dimesion pointer array
  Hi guysI want to create an array with dynamic size for the 1st, 2nd and 3rd dimesion but fix size on the last dimesion.Something like below:A ***array[4] = new ?????????;Let's say the size of 1st, 2nd, and 3rd is WIDTH, LENGTH and HEIGHT. The size for the 4th dimesion is fixed at 4.I've got really confused how would I create and delete it. Any suggestions will be highly appreciated.[Edited by - mylifemysoul on April 20, 2010 10:04:06 AM]
  Type* Var = new Type[5,6,7];:)EDIT: Oh and:delete Var;Isn't hard, isn't it?   ;Quote:Original post by WuTzType* Var = new Type[5,6,7];:)EDIT: Oh and:delete Var;Isn't hard, isn't it?Hard. I don't understand your abstract example. Could you please give me details as what I mentioned using WIDTH, LENGTH, HEIGHT and fixed size of 4 for the last dimesion? Thanks   ;  Is this C++?   ;Quote:Original post by jykIs this C++?Yes. c++;Quote:Original post by WuTzType* Var = new Type[5,6,7];:)EDIT: Oh and:delete Var;Isn't hard, isn't it?Wutz, could you post a (complete, working) code sample showing what you mean?   ;  I now am able to create my arrays using multi-vectors. Just when things come to pointers, it makes me confused.If anyone knows the answer, please advise.   ;  Something like this is what you would need, I believe. It's untested so I may have a few asterisks out of place. Anyway, I would just use a vector of a vector of a vector of vectors or rethink what I'm doing that needs this weird 4-dimensional array. :p[edit]Order of array indexing was reversed, I believe.T ***array[4];for (int i = 0; i < 4; i++)   array = new T**[WIDTH];for (int w = 0; w < WIDTH; w++)   for (int i = 0; i < 4; i++) array[w] = new T*[LENGTH];for (int l = 0; l < LENGTH; l++)   for (int w = 0; w < WIDTH; w++) for (int i = 0; i < 4; i++)    array[w][l] = new T[HEIGHT];-- array[#][w][l][h];To delete...for (int l = 0; l < LENGTH; l++)   for (int w = 0; w < WIDTH; w++) for (int i = 0; i < 4; i++)    delete [] array[w][l];for (int w = 0; w < WIDTH; w++)   for (int i = 0; i < 4; i++) delete [] array[w]for (int i = 0; i < 4; i++)   delete [] array; [Edited by - CaspianB on April 20, 2010 12:15:54 PM];  I'll go ahead and mention multi_array.   ;  Here are some examples:float* Var = NULL;Var = new float[20,30,7,4];   Var[2,7,4,2] = 100;CalculateSomething(Var[1,1,1,1]);CalculateSomething(Var[15,4,2,4]);delete Var;Here. Thats all.the variable "Var" can hold up to 20*30*7*4 floats = 16800 floats.You can access them like a chessboard. You can also put dynamic variables into that "new float".Sorry for my bad sample above. I thought you know this and just need to remember :)   