C Language

Conditional Expressions

In C Language by Baqir AliLeave a Comment

As we have seen, the following logical, relational and equality operators exist in C:

  • Logical
  • Relational
  • Equality

These operators are used in conjunction with decision and control statements. For Example

heart_rate > 75

performs the necessary comparison and evaluates to 1 (true) when heart_rate is over 75; and evaluates to 0 (false) when heart_rate is not greater than 75.

For example:

marks is in the range 40 to 100,  (40 £ marks £ b) inclusive

(marks >= 40) && (marks <= 100)

performs the necessary comparison and evaluates to 1 (true) when marks is greater than or equal to 40 AND marks is less than or equal to 100; and evaluates to 0 (false) when the either expression is false.

Get The Coding Examples From C Language Code Example Page

Leave a Comment