arrays in DMD V2

steven kladitis via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Apr 18 20:47:30 PDT 2014


Thanks, I am trying to understand what I am doing. The docs seem 
unclear to me on how to initialize these.  I think there are 
three ways.
  with brackets , the other with foreach or direct assignments.
-- here is a longer version
-- uncomment out the assignments to see the errors I get.
-- I am trying to understand arrays.



On Saturday, 19 April 2014 at 01:13:55 UTC, Jesse Phillips wrote:
> On Saturday, 19 April 2014 at 00:27:32 UTC, steven kladitis 
> wrote:
>> import std.stdio;
>>
>>
>> void main()
>> {
>>
>> int    a0[];
>> int    a1[][];
>> string a2[][];
>> string a3[][string];
>> string a4[][string][string];
>> //string a4[string][string][string]; is this the same as 
>> above????
>> int    a5[][string][string][string];
>> int    a6[string][int][string][float];
>> int    a7[int][int][string];
>>
>> // how do you initialize each array, what type are they 
>> multidimensional???
>> // how do you define all of the above with limits on each 
>> dimension???
>> }
>>
>> //help please
>
> First, don't use that syntax. everything should be placed on 
> the type:
>
> Second,
>
> void main() {
>     int    a5[][string][string][string];
>     pragma(msg, typeof(a5));
> }
>
> Third,
>
> http://dlang.org/arrays.html
> http://dlang.org/hash-map.html



More information about the Digitalmars-d-learn mailing list