C EXPRESSIONS AND STATEMENTS – A BRIEF DESCRIPTION

C EXPRESSIONS AND STATEMENTS

LOGICAL EXPRESSIONS :

Generally, Logical expressions are those expressions​ that combines two or more expressions. Furthermore, for combining these expressions we use logical operators. Generally, Logical expressions return 0 for FALSE and on the other side, 1 for TRUE. These expressions include three types of operators that are as follows :

  • AND Operator – &&
  • OR Operator – | |
  • NOT Operator – !

Some of the valid examples of Logical expressions are as follows :

  • (a > b) && (a > c)

Here, the compiler will check both of the conditions. If both of the conditions are true, then the whole expression is TRUE. Furthermore, if one of the conditions become​ false, then the whole expression is FALSE.

  • (m > 10) | | (n < 10)

Here, the compiler will check both of the conditions. The difference is that if one of the conditions is true then the whole expression is TRUE. Furthermore, the expression will become FALSE only when both of the conditions are false.

  • !(p==5)

Here, if the value of the condition is true i.e. if “p==5”. Then the compiler negates the value of the condition i.e. the result becomes FALSE. Furthermore, if the value of the condition is false, then the result becomes TRUE.

RELATIONAL EXPRESSIONS :

Relational expressions are the expressions from which we can compare values of two expressions depending​ on the relationship between them. Generally, “the expressions that contain relational operators are Relational expressions.”

Furthermore, if the relation is TRUE then the value of relational expression is 1. Also, if the relation is FALSE then the value of relational expression is 0. These expressions include six types of operators that are as follows :

RELATIONAL OPERATORS IN C - C EXPRESSIONS
https://www.slideshare.net

Some of the valid examples of Relational expressions are as follows :

  • x > y
  • a >= b
  • c == d
  • p != q

 

Thus, it was all about C EXPRESSIONS.. Now, read on further for description on C STATEMENTS..

Leave a comment

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

10 thoughts on “C EXPRESSIONS AND STATEMENTS – A BRIEF DESCRIPTION”