From Wikipedia, the free encyclopedia.
In mathematics, a ternary operation is an operation of arity three, that is, it takes three arguments.
In programming, especially in the C programming language, the "? :" operator is a ternary operator.
It takes in a boolean value, and two statements, and returns the return value of the first statement if the boolean value is true, and the return value of the second statement if the boolean value is false.
For example: (x > 3) ? (y = TOO_BIG) : (y = x); assigns TOO_BIG to y if x is greater than 3, otherwise x is assigned to y.
Some programmers regard using this ternary operator as bad practice, though it can be useful in certain circumstances to avoid excessive if statements.

