Conditional Operator C | Ternary Operator Example in C

Shorthand replacement of conditional statements, It has two parts   [  ?   :  ] also known as ternary operator, takes three operands.
Expression 1 ? Expression 2  : Expression 3   
Example max = (num1>num2)?num1:num2;

Explanation: First the condition (num1>num2) is evaluated, If it is true, the entire conditional expression takes on the value of num1 else num2 is assigned to max.

Example of Conditional  Operator
Example of Conditional  Operator in c
ternary operator

Reactions: