Re: Alocating memory depending of a variable value INT variable

2013-11-20 Thread Namespace
On Wednesday, 20 November 2013 at 00:02:42 UTC, bearophile wrote: Ali Çehreli: That is a VLA. That are currently not present in D. The most common and safe alternatives in D are allocating the memory on the heap with 'new', or over-allocating on the stack a fixed size and then slicing. T

Re: Alocating memory depending of a variable value INT variable

2013-11-19 Thread Carlos
On Tuesday, 19 November 2013 at 23:34:48 UTC, Ali Çehreli wrote: On 11/19/2013 03:16 PM, Carlos wrote:> Well in C I just declared an array during execution with an array with a > multiplied variable for the size of the array. > > Since I only need two spaces in the array for each line of process

Re: Alocating memory depending of a variable value INT variable

2013-11-19 Thread bearophile
Ali Çehreli: That is a VLA. That are currently not present in D. The most common and safe alternatives in D are allocating the memory on the heap with 'new', or over-allocating on the stack a fixed size and then slicing. If the OP really wants to allocate on the stack, there is the allo

Re: Alocating memory depending of a variable value INT variable

2013-11-19 Thread Ali Çehreli
On 11/19/2013 03:16 PM, Carlos wrote:> Well in C I just declared an array during execution with an array with a > multiplied variable for the size of the array. > > Since I only need two spaces in the array for each line of process it > was multiplied by two. > > so it was like this : > > scanf("

Alocating memory depending of a variable value INT variable

2013-11-19 Thread Carlos
Well in C I just declared an array during execution with an array with a multiplied variable for the size of the array. Since I only need two spaces in the array for each line of process it was multiplied by two. so it was like this : scanf("%d", &Num); int array[Num*2]; When I tried to do