C Programming - Functions - Discussion
Discussion Forum : Functions - Find Output of Program (Q.No. 5)
5.
What will be the output of the program?
#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);
}
}
Discussion:
96 comments Page 6 of 10.
Shafeeq said:
1 decade ago
Any simple method to find output of function with recursion?
Bala said:
9 years ago
Thanks, @Ritesh.
Your deep explanation clears all my doubt.
Your deep explanation clears all my doubt.
Surya mitthu said:
9 years ago
I don't understand this. Please someone explain this to me.
Ansh said:
1 decade ago
Can someone please explain this in the most simple manner?
Thenu said:
9 years ago
@Imran Mohammed.
Understood clearly, Thanks a lot.
Understood clearly, Thanks a lot.
Rajarshi said:
7 years ago
Here, we can Apply the concept of recursive tree.
Rupinderjti said:
1 decade ago
Amazing sree......this is called CODING IN DEPTH.
Manu said:
8 years ago
I got it as 0,1,0,2,0,1,0.
How? Please tell me.
How? Please tell me.
Rakesh said:
1 decade ago
Sree is absolutely right. Nice one. Good logic.
VIK said:
1 decade ago
PRINT(n=0), PRINT(n=1), PRINT(n=2), PRINT(n=0).
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers