scanf()'s %d format reads a single int. If you want to read an array of ints, use a loop that calls scanf() repetitively.