Hi.I know that recursion uses stack and a recursive function call itself until a terminating condition is satisfied.But i get problem in visualizing them..for example how the following program is executing...
void fun(int);
int main()
{
int a=3;
fun(a);
return 0;
}
void fun(int a)
{
if(a>0)
{
fun(--a);
printf("%d",a);
fun(--a);
}
}
the program outputs 0 1 2 0.thanks for any help.
jerico
void fun(int);
int main()
{
int a=3;
fun(a);
return 0;
}
void fun(int a)
{
if(a>0)
{
fun(--a);
printf("%d",a);
fun(--a);
}
}
the program outputs 0 1 2 0.thanks for any help.
jerico
Comment