Why is that without getchar
functions wrong? Why scanf("%c",&slovo);
doesnt get char?
int a,b;
char slovo;
scanf("%d",&a);
getchar();
scanf("%c",&slovo);
scanf("%d",&b);
getchar();
Why is that without getchar
functions wrong? Why scanf("%c",&slovo);
doesnt get char?
int a,b;
char slovo;
scanf("%d",&a);
getchar();
scanf("%c",&slovo);
scanf("%d",&b);
getchar();
Because scanf ignores linebreaks and the symbol stays in the input buffer until the next function that read from the buffer starts.