#include <stdio.h>
int main(){
while(1){
char a;
scanf("%1c",&a);
getchar();
if (a=='a'){
printf("It is a.");
}
}
}
I told scanf: "Read the first character of whatever the user gives you", and she said "yes master", but if I input the string "aaaaaaaaaaaaaaaaaaa" i get the output:
It is a.It is a.It is a.It is a.It is a.It is a.It is a.It is a.It is a.It is a.It is a.It is a.It is a.It is a.
Doesn't the %1c mean it throws away the rest of the string? As a bonus point, after I get that long output, I keep inputing a and it does nothing. What in the god damn is wrong with this cursed command?