It stops at -8 because the 10th recursive call fails the while test
(when i is decremented to 0), so only 9 printf's are executed,
resulting in 0 through -8.

On Aug 31, 9:42 am, aditi garg <[email protected]> wrote:
> @ rohit y does it stop at -8 then?
>
>
>
>
>
>
>
>
>
> On Wed, Aug 31, 2011 at 8:37 PM, rohit <[email protected]> wrote:
> > while(--i > 0) //suppose i = 1 here, so --i becomes 0, hence the condition
> > fails...so it will go 1 step back in recursion
> > {
> > main();
> > printf("%d",i);
> > }
>
> > it will execute
>
> > printf("%d",i) of prev recursion where i=0 now, so 0 gets printed...now
> > again the condition is checked i=0, thrfore --i becomes -1, so condition
> > fails
>
> > it now executes printf("%d",i) of still prev recursion and i=-1
> > here....this continues...
> > I hope this clarifies
>
> >  --
> > 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/-/bAkVsFcLH_oJ.
>
> > 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.
>
> --
> 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 [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