In the following snippet, after reading the int the '\n' remains in the stdin, and is read by second scanf.
Is scanf called on the enter, and then reads what is in the stdin, or is it called before typing happens?
What signals to scanf that the input is ready? For example if I type on my keyboard 12345, and scanf is reading an int, it can be read as 1, 12, 123 ... If the enter is the signal to read, why doesn't scanf clear that character from the stdin?
#include <stdio.h>
int main()
{
int a;
scanf( "%d", &a );
char b;
scanf( "%c", &b );
printf( "%d %c", a, b );
return 0;
}