Logical Operators:

Logical operators are used to connect multiple conditions within a if..else.. statement. The different types of Logical operators are as follows:

  1. AND Operator: &&:
  2. OR Operator: ||
  3. NOT Operator: !

Working of the Logical operators may be explained in the following way.

If two conditions are connected by a AND (&&) Operator: i.e.
if ( condition 1 && condition 2 )
Then, the statement is executed, only when both condition 1 and condition 2 are TRUE

If two conditions are connected by an OR (||) Operator: i.e.
if ( condition 1 || condition 2 )
Then, the statement is executed, when any one of the conditions is TRUE

You have viewed 1 page out of 248. Your C learning is 0.00% complete. Login to check your learning progress.

 Vote 0

Similar topics related to this section

break and continue, switch statement, continue in switch and loops, basic operators, logical operators, logical vs bitwise operators, logical and bitwise or, bit shifting, obtain bit mask,

# C Programming Language (Prentice Hall Software)
# Let Us C Paperback - 2006 by Yashavant Kanetkar
# Understanding and Using C Pointers Core techniques for memory management
# Data Structures Using C and C++ Paperback - 1998
# Data Structures In C Paperback - August 11, 2008 by Noel Kalicharan