In scanf space and \n is delimiter for the character i/p.
The below program accepts only two input.
I could not understand why does it accept two input.Please explain about this behaviour.
char a,b,c;
scanf("%c%c%c",&a,&b,&c);
printf("%c%c%c",a,b,c);
return 0;
If you enter the characters ‘123’ without seperating them by a space or a carriage return
then a is set to ‘1’, b to ‘2’ and c to ‘3’. If you seperate the characters by a space (‘1 2 3’)
then a is set 1, b to ‘ ‘ and c to ‘3’.
Note, a space is also handled as a input character!!