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[
I wonder why the above code is allowed in D? Is there a special
reason for this?
```d
import std.stdio : writeln;
void main()
{
int[0] arr = 40; // ?
typeid(arr).writeln(": ", arr); // int[0]: []
}
```
When we look at the C side, the situation is deplorable! But I
can claim that