Conditional Operator
int max = (a > b) ? a : b; // (1)!
- The
(a > b)
is evaluated first, if it results into non zero, the expression is evaluated to bea
, otherwise it is evaluated to beb
.
int max = (a > b) ? a : b; // (1)!
(a > b)
is evaluated first, if it results into non zero, the expression is evaluated to be a
, otherwise it is evaluated to be b
.