On Windows,
char c;
int i;
scanf("%d", &i);
scanf("%c", &c);
The computer skips to retrieve character from console because '\n' is remaining on buffer. However, I found out that the code below works well.
char str[10];
int i;
scanf("%d", &i);
scanf("%s", str);
Just like the case above, '\n' is remaining on buffer but why scanf successfully gets the string from console this time?