Conditional Operator
It is also a decision-making evidence. It is an disjunctive to if-else.it is identified as triplex operator as it has tern ion operands.
Syntax:
(condition)? true-case statement: false case statement;
Flow chart
Syntax:
(condition)? true-case statement: false case statement;
Flow chart
Example:
#include<stdio.h>
#include<conio.h>
void main ()
{
int x,y;
clrscr();
printf("Enter two numbers:");
scanf("%d %d",&x,&y);
x>y ? printf("%d is larger",x): printf ("%d is larger",y);
getch();
}
#include<stdio.h>
#include<conio.h>
void main ()
{
int x,y;
clrscr();
printf("Enter two numbers:");
scanf("%d %d",&x,&y);
x>y ? printf("%d is larger",x): printf ("%d is larger",y);
getch();
}