value of the static variable persists between different function call....
On Mon, Jul 18, 2011 at 11:43 PM, geek forgeek <[email protected]>wrote:
>
>
> int main()
> {
> static int var = 5;
> printf("%d ",var--);
> if(var)
> main();
> }
>
>
> y output is 5 4 3 2 1
>
> not 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5................................
>
> y on each recursive call var is not initialized again.
>
> --
> 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.
>
--
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.