Computer Science, asked by swastikmitra, 7 months ago

example of turnery operators​

Answers

Answered by DynamicNinja
5

Answer:

The ternary operator is an operator that takes three arguments.

The first argument is a comparison argument, the second is the result upon a true comparison, and the third is the result upon a false comparison. If it helps you can think of the operator as shortened way of writing an if-else statement.

Hope it helps :)

Answered by SadGirl1922
3

It helps to think of the ternary operator as a shorthand way or writing an if-else statement. Here's a simple decision-making example using if and else: int a = 10, b = 20, c; if (a < b) { c = a; } else { c = b; } printf("%d", c); This example takes more than 10 lines, but that isn't necessary.

#sadgirl❤️。◕‿◕。

Similar questions