Which combination of the integer variables $x, y$ and $z$ makes the variable $a$ get the value $4$ in the following expression?
$$a=(x > y)?((x > z) ?x:z): ((y > z) ?y:z)$$
Note: " ? : " operator associativity is Right to Left. Only Assignment, Unary & ?: operator are right to left. Rest all are left to right. http://www.difranco.net/compsci/C_Operator_Precedence_Table.htm
Using option (A) : $x=3, y=4, z=2$
$a=(3>4)?$ No
therefore don't evaluate the first part and check second part $((y>z)?y:z)$
$(4>2)?$ Yes
$a=$ value of $y =4$
Answer is (A) $x=3, y=4, z=2$
Gatecse
Thank you so much Arjun Sir!
The ...