C++ has lots of operators. Lots and lots. So far, I’ve introduced the basic operators that you require for most programs: arithmetic, comparison, assignment, subscript, and function call. Now it’s time to introduce some more: additional assignment operators, the conditional operator (which is like having an if statement in the middle of an expression), and the comma operator (most often used in for loops).
The conditional operator is a unique entry in the C++ operator bestiary, being a ternary operator, that is, an operator that takes three operands.
condition ? true-part : false-part
The condition ...