C Language: Conditional Operator (? :) Tutorial | Ternary Operator/ Conditional operator tutorial with Examples
Conditional Operator ( ? and : )
Conditional operator is a ternary operator. Ternary operator means it requires three operands.
i.e Left side expression, Middle Expression, Right side Expression.
This is written as.
How Conditional Operator Works :
Quick Notes about Conditional Operator :
- Number of Question marks(?) and Colons(:) should be Equal.
- Every Colon should be Followed by Question mark.
Program : Understanding Conditional operator with Example Program :
Minimum Value is : 5
Related Tutorials :
- Arithmetic Operators with Examples.
- Arithmetic operators priority and it’s Associativity.
- Modulus Operator and Hidden Concepts of Modulus Operator.
- Precedence Table or Operators Priority Table.
- Assignment Operator, Usage, Examples
- Increment Operator and Different types of Increment operators Usage with Examples.
- Decrement Operator and Different types of Decrement operators with Examples.
- Logical or Boolean Operators.