Conditional operator in c with example

Conditional operator is alternative to simple if-else statement


expr1 ? expr2 : expr3


expr1 is always evaluated, if results is true than expr2 is executed otherwise expr3 is executed.


Program to find given number as even or odd.

Previous Code:-
else if statement

List Code:-
C Codes

Next Code:-
Increment operator

C Programs
List of c Programs

One Comment

  1. Conditional Operator in C is a powerful Operator which can be used to implement if-then-else type of logic. This operator is also known as ternary operator in C.


Add your comments here

Back to Top