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 greatest number between 2

Previous Code:-
else-if statement

List Code:-
C++ Codes

Next Code:-
For loop

C++ Programs
List of c++ Programs

One Comment

Add your comments here

Back to Top