A ternary operator pair " ? : " is available in C to construct conditional expression of the form
exp1?exp2:exp3
where exp1, exp2, and exp3 are expressions.
#include <stdio.h>
main()
{
int a=10,b=15,x;
x=(a>b)? a : b;
printf("%d\n", x );
}
#include <stdio.h>
main()
{
int a=10,b=15,x;
if (a>b)
x=a;
else
x=b;
printf("%d\n", x );
}
15
--------------------------------
Process exited after 1.595 seconds with return value 0
Press any key to continue . . .