0
    for (int i = 0; i < N; i++)
    {
        scanf("%s ", name[i]);

        score[i][0] = i;    
        for (int j = 1; j < 4 ; j++)
        {
            scanf("%d ", &score[i][j]);   // demands additional input
        }
    }

when I input N times for last scanf, it still demands last input which isn't needed.

After seeking for the error for long time, I found the problem was the white space.

When I removed the white space, it works well.

Why does White space demand additional input?

Thank you.

  • JungHwanPark, whitespace in a format consumes _all_ input whitespace. "it still demands last input which isn't needed." --> Input continue until a non-whitespace character is detected. – chux - Reinstate Monica Jul 19 '21 at 04:48

0 Answers0