230k views
19 votes
What will be the output of the following code?

#include
void fun(int);
int main()
{
int a=3;
fun(a);
return 0;
}
void fun(int n)
{
if(n>0)
{
fun(--n);
printf("\\%d",n);
fun(--n);
}
}

User Gra
by
4.5k points

2 Answers

13 votes

Answer:

to be honest I don't know

User GlorifiedHacker
by
5.0k points
0 votes

Answer:

The output is 0, 1, 2, 0

Step-by-step explanation:

The C source code defines a void function called 'fun'. The fun function is a recursive function that is used to recursively count through a number excluding the last number, the function accepts an integer value to be counted.

User Jjfine
by
4.7k points