D string to C struct fixed-size array

rikki cattermole rikki at cattermole.co.nz
Sun Jan 3 09:28:55 UTC 2021


import std;
void main()
{
     int[] a = [1, 2, 3, 4, 5];
     int[3] b;

     b[0 .. 3] = a[1 .. 4];
     b.writeln;
}

Same principle, just remember to null terminate after slicing your 
dynamic array and assigning it to your static array.


More information about the Digitalmars-d-learn mailing list