int main(){ char a[10]; char b; printf("enter a\n"); scanf("%s",a); printf("enter b\n"); scanf("%c",&b); printf("%s %c",a,b); return 0; }
After I enter the first line of input which is stored in a, the program exits and doesn't let me take an input for b unless I clear the input buffer by using fflush(stidn). This works fine however if b were an array and I read one string after another without flushing the input buffer. Why the difference between a string input and a character input?