why does this compile fine, but dies when you run it.

steven kladitis stevenkladitis at gmail.com
Wed Mar 21 18:53:39 UTC 2018


import std.stdio;

void main(){
int[3] array1 = [ 10, 20, 30 ];
auto array2 = array1; // array2's elements are different
// from array1's
array2[0] = 11;
int[] array3;
//array4[0]=3;
array3[0]=4;
auto array4 = array3;

writeln(array1,'\n',array2,'\n',array3,'\n',array4);
}


-- windows 7 64 bit ( os ) dmd 2.079.0
-- thanks
-- Steven


More information about the Digitalmars-d-learn mailing list