Conditional operator

The conditional operator in C language, also known as the ternary operator, is a shorthand way of writing an if-else statement. It has the following syntax:

The condition is evaluated first, and if it is true, expression1 is evaluated and returned. If condition is false, expression2 is evaluated and returned. Here’s an example:

In this example, y will be assigned the value 1, because the condition (x > 5) is true. If the condition was false, y would be assigned the value 0.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

https://atozonlinesolutions.com/wp-content/uploads/2017/03/logo_white.png
https://atozonlinesolutions.com/wp-content/uploads/2017/03/logo_white.png
About
Products
Subscribe

If you wish to receive our latest news in your email box, just subscribe to our newsletter. We won’t spam you, we promise!

    Applauz

    As the pioneer of the lean startup movement, APPLAUZ has dedicated it’s time to sharing effective business strategies that help new businesses and enterpreneurs put their money to work in the right way.

    Subscribe

    If you wish to receive our latest news in your email box, just subscribe to our newsletter. We won’t spam you, we promise!

      Applauz

      As the pioneer of the lean startup movement, APPLAUZ has dedicated it’s time to sharing effective business strategies that help new businesses and enterpreneurs put their money to work in the right way.

      Copyright by BOLD THEMES. All rights reserved.