What will be printed when this program is executed?
int f(int x)
{
if(x <= 4)
return x;
return f(--x);
}
void main()
{
printf("%d ", f(7));
}
int f(int x)
{
if(x <= 4)
return x;
return f(--x);
}
void main()
{
printf("%d ", f(7));
}A. 4 5 6 7
B. 1 2 3 4
C. 4
D. Syntax error
E. Runtime error
Answer: Option C
Solution (By Examveda Team)
In this recursive function call the function will return to main caller when the value of x is 4. Hence the output.

I think its answer will printed 1 ,because if statement is wrong and compiler put by default value 1. So its answer will be printed 1.
Can anyone say the correct answer?
can anyone explain me this queiton