Why does multidimensional arrays not allocate properly?

albert-j via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Jan 22 01:30:53 PST 2017


> In anycase, what is the correct notation for indexing?
>
> x = new int[][](width, height)
>
> and x[height][width] or x[width][height]?

It's x[width][height], but because indexing is 0-based, largest 
valid indexes are
x[width-1][height-1].




More information about the Digitalmars-d-learn mailing list