You are specifying a width parameter in the %d specifier ("%[width]d" scans a maximum of "width" characters). scanf stops scanning once that many characters are read so the next %d scans from the last position.