Take the snippet below:
int main()
{
int a;
char c;
scanf("%d",&a);
scanf("%c",&c);
printf("%d%c",a,c);
return 0;
}
And lets say your inputs are 5 and a. The out put of the printf
statement will be 5 followed by a newline, rather than the 'a'. I know this is because the scanf
function treats the ENTER as a character, and that 'a' is really the third item in the queue, but is there a way to skip the ENTER without resorting to using an additional scanf
statement?