What is ternary operator in c with example?

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.20 Oca 2020

Sizin İçin Seçtik  What is conditional operator in c?

Leave a Reply

Your email address will not be published. Required fields are marked *