Discuss the function of conditional operator, size of operator and comma operator with examples
Answers
Answered by
1
The conditional operator (? and :) is a special operator which requires three operands. Its syntax is as follows:
Syntax: expression1 ? expression2 : expression3
Here is how the conditional operator works.
The first expression1 is evaluated, if it is true then the value of expression2 becomes the result of the overall expression.
On the other hand, if expression1 is false, then the value of expression3 becomes the result of the overall expression.
Similar questions