Multiple Dynamic Array
Jarrett Billingsley
kb3ctd2 at yahoo.com
Mon Dec 25 17:52:05 PST 2006
"efgee" <efgee2003 at yahoo.com> wrote in message
news:emps0s$50k$1 at digitaldaemon.com...
> Here now a dynamic array.
> There must be something missing, because it compiles but there is a
> ArrayBoundsError on runtime.
Yep, you're missing the initializations. The statically-sized arrays are
allocated on the stack, so they're like local variables. But by default,
dynamically-sized arrays don't point to anything. Or, another way to think
of it is that they're dynamically-sized but they always start with a size of
0.
> int[][][] A;
> char[][][] B;
Replace these with:
int[][][] A = new int[][][](64, 64, 64);
char[][][] B = new char[][][](64, 64, 64);
More information about the Digitalmars-d-learn
mailing list