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);
    }
}
0, 2, 1, 0,
1, 1, 2, 0,
0, 1, 0, 2,
0, 1, 2, 0,
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
96 comments Page 8 of 10.

Piya said:   1 decade ago
Please any one explain in breif clearly.

Sanjib Kumar Mandal said:   4 years ago
Thanks all for giving the explanation.
(1)

Priya said:   9 years ago
I can't understand. Please help me.

Shivanand said:   1 decade ago
Can any one explain in simple way ?

Asha said:   8 years ago
Thank you guys. I understood stack.

Jhunu said:   1 decade ago
Thanks Ritesh. You are excellent.

Tushar said:   8 years ago
How does calling function works ?

Manjunath Rk said:   8 years ago
Good explaination, Thanks @Sree.

Abhijit Dey said:   8 years ago
Good explanation, Thanks @Sree.

Popat said:   1 decade ago
Its correct answer Thanks Sree


Post your comments here:

Your comments will be displayed after verification.