C | Functions | Question 11
Output of following program?
(A) 7 6 5
(B) 5 6 7
(C) 7 7 7
(D) Compiler Dependent
Explanation: When parameters are passed to a function, the value of every parameter is evaluated before being passed to the function.
What is the order of evaluation of parameters – left-to-right or right-to-left?
If evaluation order is left-to-right, then output should be 5 6 7 and if the evaluation order is right-to-left, then output should be 7 6 5. Unfortunately, there is no fixed order defined by C standard. A compiler may choose to evaluate either from left-to-right.
So the output is compiler dependent.
Quiz of this Question
My Personal Notes arrow_drop_up
Please Login to comment...