char c;
printf("%d", scanf("%s", &c)); // prints 1
printf("%d", scanf("%c", &c)); // prints 1
I do not understand why both these statements prints the same value 1
?
As far as I know, scanf()
returns the number of input items successfully matched and assigned or even zero in the event of an early matching failure. Then is this not the case of mismatching?
What did I miss here?