Is it possible to dynamicaly allocate space for a multidimentional array.
or something like that?Code:int* var = new int* ;
This is a discussion on Multidimentional Array Dynamic Allocation within the C++ Programming forums, part of the General Programming Boards category; Is it possible to dynamicaly allocate space for a multidimentional array. Something like: Code: int* var = new int* ; ...
not quite, here's an example
Code:int ** ptr = new int * ; for (int i = 0; i < 3; i++) ptr[i] = new int ;
http://www.parashift.com/c++-faq-lit...html#faq-16.16Originally Posted by mrafcho001
Or a vector of vectors?
7. It is easier to write an incorrect program than understand a correct one.
40. There are two ways to write error-free programs; only the third one works.*
> but I though maybe there was an easier way
There is, if all your minor dimensions are constant.
int (*var) = new int;