How to create an array with custom length?
Anonymouse
zorael at gmail.com
Fri Mar 27 19:46:53 UTC 2020
On Friday, 27 March 2020 at 19:30:39 UTC, Quantium wrote:
> Code
> int n=0;
> readf(" %d", &n);
> int[n] m;
> generated an error (DMD compiler):
> Cannot read n at compile time.
> How to create an array with custom length?
The tour has a page for this:
https://tour.dlang.org/tour/en/basics/arrays
int n=0;
readf(" %d", &n);
int[] m = new int[n];
More information about the Digitalmars-d-learn
mailing list