Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   how this recursive function is working (http://www.go4expert.com/forums/recursive-function-t27103/)

pvicky_20 7Nov2011 14:57

how this recursive function is working
 
Code:

#include<stdio.h>
void fun(int);
typedef int (*pf) (int, int);
int proc(pf, int, int);

int main()
{
    int a=3;
    fun(a);
    return 0;
}
void fun(int n)
{
    if(n > 0)
    {
        fun(--n);
        printf("%d,", n);
        fun(--n);
    }
}


poornaMoksha 16Nov2011 17:10

Re: how this recursive function is working
 
What are you trying to achieve with this code?
Please be more precise with your question.

archanababu 21Nov2011 15:39

Re: how this recursive function is working
 
Output of the recursive funtion is 20
I like C & C++. So i always looking challenges in programming


All times are GMT +5.5. The time now is 07:43.