Assuming that the inputs are:
6 4
0 1 2 2 1 0
1 0 0 0 0 1
1 0 0 0 0 1
0 1 1 1 1 0
6 and 4 are width and height respectively. What I used is:
scanf("%d %d", &width, &height);
Then I put the rest of the inputs in the 2D-array (board[height][width]) using for loops. The problem is about validating the width and height.
When I input
6 4
0 1 2 2 1 0
1 0 0 0 0 1
1 0 0 0 0
0 1 1 1 1 0
one input is missed but it waits until one more number is entered. How can I manage this and make it to occur an error if lack of or too many inputs are being put?
Can someone help me out with this problem? Thanks!!