logo
Conditional Operators In C Language
Conditional operator is used to check a condition and Select a Value depending on the Value of the condition. 
  Syntax :
Variable = (condition)? Value 1: Value 2: 

If the Value of the condition is true then Value 1 is e valued assigned to the variable, otherwise Value2.

  Program : A program to illustrate the use of Conditional Operators
#include<stdio.h>
void main ()   
{
int x=1, y;
Y=(x==1? 2: 0);
Printf (“\n x value is: %d”, x);
Printf (“\n y value is: %d”, y);
 }
Output :

X value is: 1
Y value is: 2