In first case first character input is 'a' and second is space so loop
breaks
in second loop runs till b is not read hence all characters including spaces
are found in output



On Wed, Jul 20, 2011 at 7:29 PM, mohit <mohit89m...@gmail.com> wrote:

> guys.... just give input a stream of characters as: a a a a a a a a a
> a a a   <---(press enter)
>
> for second  case input as:  c d e f g h i j b <-----(press enter)
> and see the difference. (I know that printf() is line buffered. So
> why....?)
>
> 1.printf() shows 'a'   one time only.
>
> 2.here it shows characters entered exactly until program reads 'b'.
>
>
> On Jul 20, 6:49 pm, akash_mbm <vikaskumarsi...@gmail.com> wrote:
> > void main()
> > {
> >      char a,b,c;
> >
> >      scanf("%c%c%c",&a,&b,&c);
> >      printf("\n%c %c %c\n", a,b,c);
> >
> > }
> >
> > ............................
> > You may figure out from the above test code whats happening while
> > character input.
> >
> > Its taking '\r' too as a character input as in your case 1st, which is
> > not the same in 2nd case
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
Sunny Aggrawal
B-Tech IV year,CSI
Indian Institute Of Technology,Roorkee

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to