Re: [algogeeks] Re: C code scanf problem

2011-08-24 Thread lakshay girdhar
i hav executed it in dev.. it waits for second scanf On Wed, Aug 24, 2011 at 7:05 PM, Mehnaaz mehnaazmohiud...@gmail.com wrote: @lakshay and sanju.after placing fflush(stdin), i am continuing to get the same output...is there anything else i can do..? and will you also please execute and see

[algogeeks] Re: C code scanf problem

2011-08-24 Thread Mehnaaz
@ vikas ..the space actually worked !!..is there any explanation ??..thanks a ton! -- 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] Re: C code scanf problem

2011-08-24 Thread Don
The problem is that scanf(%c will take whatever character is next, even if it is not the one you think you typed. When you typed your first entry, the number 3 and then pressed Return, the \n character is left in the buffer, so your scanf gets that character instead of the one you want. The space

[algogeeks] Re: C code scanf problem

2011-08-24 Thread Anurag Gupta
@ Mehnaaz :the variable no_p will be equal to 0,since it is an external one so the declaration char p[no_p][max] is equivalent to p[0][max]; and size of p is zero. then how you can insert anything into it as you are doing in for loop? no_p may receive some non zero value afterwards but array p is

[algogeeks] Re: C code scanf problem

2011-08-24 Thread Mehnaaz
that was actually a mistake , i should have taken the value before i declared it BUT as for arrays goes, we know we can access the a[10] even though we may just declare a[5] ! may be its the same reason i was able to read in for loop besides here having the size of column matters more than the

[algogeeks] Re: C code scanf problem

2011-08-24 Thread Ninad Page
On Aug 24, 6:00 pm, Sanjay Rajpal srn...@gmail.com wrote: after first scanf, place a call to fflush(stdin). you will get the result. Sanju :) Flushing the input stream is undefined. On Wed, Aug 24, 2011 at 5:58 AM, Mehnaaz mehnaazmohiud...@gmail.com wrote: #include stdio.h

[algogeeks] Re: C code scanf problem

2011-08-24 Thread KK
Using getchar() after the first scanf ll be much better...!! -- 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