D Static Array

Adam D Ruppe destructionator at gmail.com
Sun Jan 15 14:56:37 UTC 2023


On Sunday, 15 January 2023 at 14:23:59 UTC, Salih Dincer wrote:
>     int[0] arr = 40; // ?

The = 40 means fill all array entries with the number 40.

The [0] means there are no array elements.

So it filled all the 0 elements with the number 40.

If it was like int[3] arr = 40, then arr[0], arr[1], and arr[2] 
would all be 40.


>> In C99 and later C standards, an array size can be defined as 
>> 0 and it can include a feature called flexible array member 
>> (FAM) which is an array member without specifying its size

This is not supported in D.


More information about the Digitalmars-d-learn mailing list