The conditional operator in C is kind of similar to the if-else statement as it follows the same algorithm as of if-else statement but the conditional operator takes less space and helps to write the if-else statements in the shortest way possible. It is also known as the ternary operator in C as it operates on three operands.
The conditional operator can be in the form
variable = Expression1 ? Expression2 : Expression3;
variable = (condition) ? Expression2 : Expression3;
(condition) ? (variable = Expression2) : (variable = Expression3);
Program.c
output.c
With supporting text below as a natural lead-in to additional content.