these two are same On Aug 31, 7:36 pm, ravi maggon <maggonr...@gmail.com> wrote: > I check out the code: > > #include<stdio.h> > main() > { > static int i=10; > while(i>0) > { > --i; > main(); > printf("%d",i); > } > > } > > if you run this you get 0000000000 as output > > but if you run this > > #include<stdio.h> > main() > { > static int i=10; > while(i>0) > { > --i; > main(); > printf("%d",i); > } > > } > > You get 0-1-2-3-4-5-6-7-8 as output. > > Whats the difference in these? > > On Wed, Aug 31, 2011 at 7:52 PM, aditi garg <aditi.garg.6...@gmail.com>wrote: > > > > > > > > > > > @abhishek: y till -8? > > > On Wed, Aug 31, 2011 at 7:50 PM, vishal jain <vishal.l...@gmail.com>wrote: > > >> I executed on linux machine.. > > >> I am gettign output > > >> 0-1-2-3-4-5-6-7-8 :( > > >> for code > >> int main() > > >> { > >> static int i=10; > >> while(--i>0) > >> { > >> main(); > >> printf("%d",i); > >> } > >> return 0; > >> } > > >> On Wed, Aug 31, 2011 at 7:48 PM, Abhishek Mallick < > >> abhishek.mallick2...@gmail.com> wrote: > > >>> The recursion will run 10 times printing nothing. Then ones it returns > >>> on the 10th one. It will start printing from 0 to -8 (As i is static). > > >>> On Aug 31, 6:33 pm, ravi maggon <maggonr...@gmail.com> wrote: > >>> > Ans would be 0000000000, keep in mind that i is static variable. > > >>> > On Wed, Aug 31, 2011 at 6:59 PM, rohit <raman.u...@gmail.com> wrote: > >>> > > 123456789 > > >>> > > -- > >>> > > You received this message because you are subscribed to the Google > >>> Groups > >>> > > "Algorithm Geeks" group. > >>> > > To view this discussion on the web visit > >>> > >https://groups.google.com/d/msg/algogeeks/-/OsL6-Vp91qoJ. > >>> > > 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. > > >>> > -- > > >>> > Regards > >>> > Ravi Maggon > >>> > Final Year, B.E. CSE > >>> > Thapar University > > >>> -- > >>> 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. > > > -- > > Aditi Garg > > Undergraduate Student > > Electronics & Communication Divison > > NETAJI SUBHAS INSTITUTE OF TECHNOLOGY > > Sector 3, Dwarka > > New Delhi > > > -- > > 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. > > -- > > Regards > Ravi Maggon > Final Year, B.E. CSE > Thapar University
-- 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.