1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

how this recursive function is working

Discussion in 'C' started by pvicky_20, Nov 7, 2011.

  1. pvicky_20

    pvicky_20 New Member

    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 a moderator: Nov 7, 2011
  2. poornaMoksha

    poornaMoksha New Member

    What are you trying to achieve with this code?
    Please be more precise with your question.
     
  3. archanababu

    archanababu Banned

    Output of the recursive funtion is 20
    I like C & C++. So i always looking challenges in programming
     

Share This Page