Dynamic memory
Adam D. Ruppe via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Jul 24 08:38:44 PDT 2015
On Friday, 24 July 2015 at 15:33:45 UTC, Binarydepth wrote:
> int liCases [2][];
Those brackets are in the wrong place, you should write that as
int[2][] liCases;
The syntax you used there is a deprecated C compatibility
feature. in C, arrays are defined differently and the dimensions
go in the opposite direction than in D. (So int a[2][] in C means
int[][2] in D - that's why the length doesn't change in that
format.)
But write it the D style for most consistency and it will work
out. Just be aware that what I wrote is a dynamic array of two
elements, not a two element group of dynamic arrays. So indexing
is
liCases[i][0] and liCases[i][1] rather than swapping those.
More information about the Digitalmars-d-learn
mailing list