Returning dynamic array from the function

Marco Cosentino via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Jun 14 14:37:50 PDT 2014


>         int[] data = [1,2,3,4];    // create new array on the 
> heap

Thanks for the answer.
This is the bit of information I was missing: how to create an
array in the heap.
Is also this a valid way to do so?

int[] data = new int[0];
data ~= [4,2,3,1];



More information about the Digitalmars-d-learn mailing list