Doubt - Static multidimension arrays

tsbockman via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jan 21 15:35:52 PST 2016


On Thursday, 21 January 2016 at 01:36:21 UTC, Nemo wrote:
> I don't remember where I saw it, but actually, in static 
> multi-dimensional arrays, arr[0][1] is next to arr[0][0] in 
> memory. You can see it with:
>
> void main () {
>   ubyte [7][5] arr;
>   import std.stdio : writeln;
>   writeln ( & arr[0][0], " ", & arr[0][1], " ", & arr [1][0] );
> }

Yes. That's consistent both with what I wrote in the message that 
you quoted, and with how non-static arrays work.

dpaste: http://dpaste.dzfl.pl/5ca02bd98f82


More information about the Digitalmars-d-learn mailing list