Explain the working of conditional operator
with an example. What type of operator is
it?
Answers
Answer:
The result of the conditional operator is the result of whichever operand is evaluated — the second or the third. Only one of the last two operands is evaluated in a conditional expression. Conditional expressions have right-to-left associativity. ... If both operands are of the same type, the result is of that type.
Explanation:
An Example of Conditional Operators
The conditional operator "&&" first evaluates whether its first operand (i.e., number % 2 == 0) is true and then evaluates whether its second operand (i.e., number % 4 == 0) is true. As both are true, the logical AND condition is true. Leahy, Paul.
Answer:
An Example of Conditional Operators
The conditional operator "&&" first evaluates whether its first operand (i.e., number % 2 == 0) is true and then evaluates whether its second operand (i.e., number % 4 == 0) is true. As both are true, the logical AND condition is true. Leahy, Paul.