Ternary

Similar to the if statement, tests if a condition is true or false.

 

condition ? true : false ;

 

(5 < 7) ? printf("5 is less than 7") : printf("this will never be printed") ;

Compile & run:

5 is less than 7

Leave a Reply