syntax for conditional operator
Answers
Answered by
3
CONDITIONAL OR TERNARY OPERATORS IN C:Conditional operators return one value if condition is true and returns another value is condition is false.This operator is also called as ternary operator.Syntax : (Condition? true_value: false_value);Example : (A > 100 ? 0 : 1);In above example, if A is greater than 100, 0 is returned else 1 is returned. This is equal to if else conditional statements.
Answered by
2
expression 1 ? expression 2 : expression 3
expression2 is Statement Followed if Condition is True
expression3 is Statement Followed if Condition is False
where
expression1 is Conditionexpression2 is Statement Followed if Condition is True
expression3 is Statement Followed if Condition is False
Similar questions
English,
8 months ago
Social Sciences,
1 year ago