Dynamic memory
anonymous via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Jul 28 09:53:34 PDT 2015
On Tuesday, 28 July 2015 at 16:41:40 UTC, Binarydepth wrote:
> It works with 2 as input but shows error when number is 3 :(
I can't reproduce that or I misunderstood something:
$ cat a.d
import std.stdio : readf, writef;
void main() {
int[2][] nam;
int num;
readf(" %d", &num);
nam.length = num;
foreach(nim; 0..num) {
readf(" %d %d", &nam[nim][0], &nam[nim][1]);
}
foreach(nim; 0..num) {
writef(" %d %d\n", nam[nim][0], nam[nim][1]);
}
}
$ dmd a.d
$ ./a
3
1 2
3 4
5 6
1 2
3 4
5 6
More information about the Digitalmars-d-learn
mailing list