Allocating large 2D array in D

bearophile bearophileHUGS at lycos.com
Tue Feb 5 10:38:40 PST 2013


H. S. Teoh:

> Added to wiki: 
> http://wiki.dlang.org/Dense_multidimensional_arrays

It contains:

enum columns = 100;
int rows = 100;
double[gridSize][] gridInfo = new double[columns][](rows);


gridSize is undefined. I suggest to write something like:

enum nColumns = 100;
int nRows = 120;
double[nColumns][] matrix2 = new double[nColumns][](nRows);

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list