when I write a for loop to scanf some int value, the output is correct. however, I try to this loop to scanf some char value, it seems something wrong.(I was wondering the space or '\t' as a char to be scanned)
//when the input are
2
1 2
3 4
//
#include<stdio.h>
int main(void){
int n;
scanf("%d", &n);
int x;
int y;
for(int i = 0; i< n; i++){
scanf("%d %d", &x, &y);
}
return 0;
}
//when I enter
2
a b
the program is finished and i cannot enter more char.
//
#include<stdio.h>
int main(void){
int n;
scanf("%d", &n);
char x;
char y;
for(int i = 0; i< n; i++){
scanf("%c %c", &x, &y);
}
return 0;
}