Correct option is A
In
C programming, the
ternary operator is also referred to as the
conditional operator. It is a shorthand way of writing an if-else condition. The syntax is:
condition ? expression1 : expression2
If the condition evaluates to true, expression1 is executed; otherwise, expression2 is executed.
Important Key Points:
1. The
ternary operator consists of three operands: a condition, the value if true, and the value if false.
2. It is primarily used for concise conditional assignments.
3. Example: int max = (a > b) ? a : b; assigns the greater value between a and b to max.
Knowledge Booster:
·
Logical Operator: Used for logical comparisons, such as && (AND), || (OR).
·
Bitwise Operator: Operates on binary representations, such as &, |, ^.
·
Relational Operator: Compares values, such as > (greater than), < (less than).
·
Arithmetic Operator: Performs basic math operations like +, -, *, /.