declaration/initialization of multidimensional arrays

bearophile bearophileHUGS at lycos.com
Sun Nov 18 16:55:46 PST 2012


> auto a = new double[][](M, N);

That's a way to declare and initialize a dynamic array of dynamic 
arrays. If you want to allocate something else, you need a 
different syntax.

Example, this creates something rather different:

auto b = new double[][3][](M, N);

In D there are both dynamic arrays and fixed-sized arrays, 
thankfully.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list