Re: [Beginner]Variable length arrays

2017-02-25 Thread helxi via Digitalmars-d-learn
On Saturday, 25 February 2017 at 14:34:31 UTC, rikki cattermole wrote: On 26/02/2017 3:31 AM, helxi wrote: I am trying to create an array which has a user defined size. However the following program is not compiling: import std.stdio; void main(){ write("Enter your array size: ");

Re: [Beginner]Variable length arrays

2017-02-25 Thread rikki cattermole via Digitalmars-d-learn
On 26/02/2017 3:31 AM, helxi wrote: I am trying to create an array which has a user defined size. However the following program is not compiling: import std.stdio; void main(){ write("Enter your array size: "); int n; readf(" %s", ); int[n] arr; //<-Error: variable input cannot

[Beginner]Variable length arrays

2017-02-25 Thread helxi via Digitalmars-d-learn
I am trying to create an array which has a user defined size. However the following program is not compiling: import std.stdio; void main(){ write("Enter your array size: "); int n; readf(" %s", ); int[n] arr; //<-Error: variable input cannot be read at compile time