Fixed size array initialization
rumbu
rumbu at rumbu.ro
Sun Feb 11 07:30:19 UTC 2018
On Sunday, 11 February 2018 at 01:26:59 UTC, psychoticRabbit
wrote:
> On Sunday, 11 February 2018 at 01:13:00 UTC, psychoticRabbit
> wrote:
>>
>> Well, in C.. I can do:
>>
>> int arr[2] = { [0]=10, [1]=20 };
>>
>> I cannot work out how to do that in D yet (anyone know??)
>>
>
> Oh. just worked it out after reading this thread ;-)
>
> int[2] arr = [ 0:10, 1:20 ];
This is indeed the most simple and elegant solution. Thanks.
More information about the Digitalmars-d-learn
mailing list