Mail Archives: djgpp/1998/08/18/12:15:41
Endlisnis wrote:
> If you need more than one dimension to be
> dynamic, then you have to 'fake-it'. If you want something NxM, then:
> char* Array = new /* or malloc */ [N*M];
> Array[X*N+Y]; //To access Array[X][Y].
Not true. You can first allocate a array of pointers to the data type,
and then for each element of the array allocate arrays of the data type
and assign it to that index. That gives you a fully-dynamic two
dimensional array, but in addition requires N + 1 pointers and N + 1
allocations.
--
Erik Max Francis / email max AT alcyone DOT com / whois mf303 / icq 16063900
Alcyone Systems / irc maxxon (efnet) / finger max AT sade DOT alcyone DOT com
San Jose, CA / languages En, Eo / web http://www.alcyone.com/max/
USA / icbm 37 20 07 N 121 53 38 W / &tSftDotIotE
\
/ Shooters, looters; now I got a laptop computer
/ Ice Cube
- Raw text -