The statement c = (n) ? a : b; can be rewritten as
Answer: A
Correct answer: if(n){c = a;}else{c = b;}
The conditional operator evaluates its first operand as a condition: if it is true the result is the second operand, otherwise the third. So c = n ? a : b; assigns a when n is non-zero and b when it is zero - exactly what the first if-else does.
Please log in or register to report this question.