John has given a good resolution. Constructing  a class, or even a struct to
save every map info:

typede struct map_s{
   int xRes;
   int yRes;
   int squareLimit;
} map_t;

then you just  need declare an 1d array to save your map-list with user
defined variable:

  map_t *objMapList = new map_t[map_num];




2009/5/23 John Gaughan <[email protected]>

>
>
> Jos Timanta Tarigan wrote:
> > hi,
> > im currently try to build a 3d array (array with three index) but the
> size is 'user defined'.
> > so in the header file, i declare a pointer to pointer to pointer to int
> > int *** array;
> > but im confused how to set it in the cpp file (setting the data). i've
> tried this:
> > objectMapList = new int[xRes][yRes][squareLimit];
> > with xRes, yRes, and squareLimit is a user defined variable. but it does
> not work. any idea?
> >
>
> When declaring a multi-dimensional array, all but the final array size
> must be static. To declare an array where all lengths are variable, you
> have to allocate the first array, then allocate each element of the
> second, etc.
>
> Multidimensional arrays hurt my brain. Someone else can probably give an
> example. My solution: use objects and classes, and try to make each one
> as simple as possible.
>
> --
> John Gaughan
> http://www.jtgprogramming.org/
>
>  
>


[Non-text portions of this message have been removed]

Reply via email to