Dynamic memory

Binarydepth via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Jul 24 08:36:26 PDT 2015


On Friday, 24 July 2015 at 15:26:27 UTC, Adam D. Ruppe wrote:
> 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.

Ok, Sorry I was declaring the array in C style also. It compiled 
after chaging it. :D

TY


More information about the Digitalmars-d-learn mailing list