Trying to understand multidimensional arrays in D

Profile Anaysis via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jan 25 21:44:04 PST 2017


On Thursday, 26 January 2017 at 03:02:32 UTC, Jonathan M Davis 
wrote:
> On Thursday, January 26, 2017 01:47:53 Profile Anaysis via 
> Digitalmars-d- learn wrote:
>>      [...]
>
> Like in C/C++, types are mostly read outward from the variable 
> name in D. In both C/C++ and D,
>
> [...]

Thanks. I'll just have to play around with them a bit until it 
sinks in. I think my problem was declaring them wrong which would 
always lead to weird errors.

I am using static arrays because the size of the matrix is fixed. 
I need to allocate them though because that is what my 
matrix_history contains.

I guess I can do that with new int[n][n] type of thing? (I think 
I tried that before.

Anyways, probably would work fine now but I already move don to 
wrapping it in a struct. It provides more flexibility in my case.




More information about the Digitalmars-d-learn mailing list