Consider the expression given below in C. x ? y : a ? b : c
Consider the expression given below in C.
x ? y : a ? b : c
What will be the value of the given expression if x = 0 and a = 0?
Show answerHide answer
Correct answer: (B) Equivalent to the value of c.
Explanation
The ?: operator is right-associative, so the expression is x ? y : (a ? b : c). x = 0 picks the second part, and a = 0 then picks c.