it takes \n as character on input buffer for each enter keystroke
so use fflush(stdin); before 2nd scanf.

On Wed, Aug 24, 2011 at 6:30 PM, Sanjay Rajpal <srn...@gmail.com> wrote:

> after first scanf, place a call to fflush(stdin).
>
> you will get the result.
>
> Sanju
> :)
>
>
>
> On Wed, Aug 24, 2011 at 5:58 AM, Mehnaaz <mehnaazmohiud...@gmail.com>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 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.
>>
>>
>  --
> 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.
>



-- 
-Warm Regards
LAKSHAY
NIT-K

-- 
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