A conditional statement is a ternary operator. It has three blocks the condition or expression block, the true block and the false block. A conditional statement is a single line statement which can be used as replacement for if .. else statement.

Syntax for conditional statement:
exp ? true block : false block

In the conditional statement an expression or condition is provided and if the condition is true then the true block is executed but if the conditioin is false then the false block is executed.

Program example of conditional statement

//An example of conditional statement
#include<stdio.h>

int main()
{
    int a = 10, b = 20;
    (a > b)?printf("greatest is a\n"):printf("greatest is b\n");
    return 0;
}

output

greatest is b


In above example we have two variables a = 10 and b = 20. In the conditional statement we have provided a condition (a>b) which is false, therefore the false block is executed.