how this recursive function is working

Newbie Member
7Nov2011,14:57   #1
pvicky_20's Avatar
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);
    }
}

Last edited by shabbir; 7Nov2011 at 19:32.. Reason: Code blocks
Ambitious contributor
16Nov2011,17:10   #2
poornaMoksha's Avatar
What are you trying to achieve with this code?
Please be more precise with your question.
Banned
21Nov2011,15:39   #3
archanababu's Avatar
Output of the recursive funtion is 20
I like C & C++. So i always looking challenges in programming