?
What will be printed when this program is executed?
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));
}
Answer & Solution
Correct Answer:
Option
C
In this recursive function call the function will return to main caller when the value of x is 4. Hence the output.
Join the Discussion
Login to post a comment or share your explanation.
LoginCan anyone say the correct answer?