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 row size..(see passing 2d arrays as
parms)

On Aug 24, 8:30 pm, Anurag Gupta <[email protected]> wrote:
> @ 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 not re-
> declared so
> it doesnt has any space alloted to it ,then how for loop is working
> without any glitch?
>
> On Aug 24, 5:58 pm, 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.

Reply via email to