Vidyalelo
C Programming · Q42

Function

Programming · C Programming · question 42

Q42

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));

A.
4 5 6 7
B.
1 2 3 4
C.
4
Answer
D.
Syntax error
E.
Runtime error

Answer: Option C

Solution

Answer: Option C
Solution:

In this recursive function call the function will return to main caller when the value of x is 4. Hence the output.