On Aug 24, 6:00 pm, Sanjay Rajpal <[email protected]> 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 <[email protected]> wrote: > > #include <stdio.h> > > #define max 30 > > int no_p; > > int main() { > > > char p[no_p][max]; > > char x; > > int i=0; > > printf("enter the no of productions..\n"); > > scanf("%d", &no_p); > > printf("you have entered :%d\n", no_p); > > printf("Variable who's FOLLOW you want\n"); > > scanf("%c", &x); > > printf("you have entered :%c",X); > > printf("\n"); > > for( i =0 ; i< no_p ; i++){ > > printf("enter the production # %d",i+1); > > scanf("%s",p[i]); > > } > > //follow(p,x); > > return 0; > > } > > > the output i am getting goes like this > > ...................................... > > enter the no of productions.. > > 3 > > you have entered :3 > > Variable who's FOLLOW you want > > you have entered : > > > enter the production # 1 > > ........................................... > > at the line 4 of the output its supposed to wait for my scanf() entry > > value right??..but it executes the printf after that giving "you have > > entered" > > > i'm using gcc to compile this > > > -- > > You received this message because you are subscribed to the Google Groups > > "Algorithm Geeks" group. > > To post to this group, send email to [email protected]. > > To unsubscribe from this group, send email to > > [email protected]. > > For more options, visit this group at > >http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
