On Saturday, 14 June 2014 at 21:37:51 UTC, Marco Cosentino wrote:
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];

Simply "int[] = [4,2,3,1];" will do. Arrays are always created on the heap by default. To override that, you can assign to a static array, which resides on the the stack. Then you slice your static array.

Reply via email to