What Does Ternary Operator Return
The Ternary Operator Is Used to Return a Value Based on the Result of a Binary Condition. It Takes in a Binary Condition as Input, Which Makes It Similar to an...
The ternary operator is used to return a value based on the result of a binary condition. It takes in a binary condition as input, which makes it similar to an ‘if-else’ control flow block. It also, however, returns a value, behaving similar to a function.
What does ternary operator return in c?
This operator returns one of two values depending on the result of an expression. If “expression-1” is evaluated to Boolean true, then expression-2 is evaluated and its value is returned as a final result otherwise expression-3 is evaluated and its value is returned as a final result.
Can we write return in ternary operator?
The ternary operator has return type.