Syntax : Expression1? Expression2 : Expression3 ;
The Operator
?: works as follows: Expression1 is evaluated first. If it is true, then the Expression2 is evaluated and becomes the value of the expression. If Expression1
is false, then Expression3 is evaluated and its value becomes the value of the
expression.
Example : a = 500;
b = 700;
x = (a > b) ? a : b ;
Here x get the value of b because expression a > b is false.
x = b = 700
0 Comments
Post a Comment