Whoops, there was a mistake: Reading array of integers: int[100000] array; //somewhere in static storage, faster ... scanf("%d",&n); foreach(ref x;array[0..n]) scanf("%d",&x); // note the slice Timon