February 23, 2025

Telugu Tech Tuts

TimeComputers.in

C Language in telugu Conditional Operator Part 17

The conditional operator in C is also known as ternary operator. It is called ternary operator because it takes three arguments. The conditional operator evaluates an expression returning a value if that expression is true and different one if the expression is evaluated as false.

Syntax:
condition ? result1 : result2;
1

condition ? result1 : result2;

If the condition is true, result1 is returned else result2 is returned.
#include
#include
void main()
{
int a = 10, b = 11;
int c;
c = (a < b)? a : b; printf(ā€œ%dā€, c); }