Well I think the reason is very simple: When you enter the loop through L, the value of i is not initialized to 0, it is some garbage value. now while exiting the loop, the condition is checked for another iteration. Since the value of i is unknown, it might be the case that i<j for a lot of number of times before the loop actually ends.
But it is not a runtime error, and no infinite loop. the loop will end, the moment value of i becomes >= j. On 4 August 2011 11:00, TUSHAR <tusharkanta.r...@gmail.com> wrote: > #include<stdio.h> > main() > { > int j=4,i; > goto L; > for(i=0;i<j;i++) > { > > L: > printf("%d",j); > } > } > > > > > why this is giving infinite loop.................Runtime error ? > > > > -- > 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. > > -- ___________________________________________________________________________________________________________ Please do not print this e-mail until urgent requirement. Go Green!! Save Papers <=> Save Trees -- 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.