[Solved] How recursion works in this code? [duplicate]

[ad_1]

can you try the following piece of code.

#include<stdio.h> 
count(int);  
int  main() 
{ 
    int x=4; 
    count(x); 
    return 0; 
} 

int count(int n) 
{ 
    if(n>0) 
    {  
        printf("%d",n); 
        return count(n-1);
    }
    else
    {
        printf("%d",n); 
        return n; 
    } 
} 

4

[ad_2]

solved How recursion works in this code? [duplicate]