Dynamic memory

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Jul 24 08:26:25 PDT 2015


On Friday, 24 July 2015 at 15:22:15 UTC, Binarydepth wrote:
> I want to use memory based on user input. In this case declare 
> a bi-dimensional array (int[2][var]), var being the user input.

Declare:

int[2][] your_array;

your_array.length = var;


The runtime will handle the dynamic memory allocation for you 
when you set the length on a slice.


More information about the Digitalmars-d-learn mailing list