Which is the only ternary operator in C, taking three operands?
Correct answer D. ?: (conditional operator)
Explanation
The conditional operator cond ? a : b takes three operands: it evaluates cond, then evaluates and yields exactly one of a or b. && and the comma operator are binary, taking two operands, and -> takes a pointer and a member name. Because only the chosen branch is evaluated, ?: can safely guard an expression, as in p ? p->x : 0.
Answer checked How we write and check questions
Discussion