Wednesday, May 14, 2008

Logical operators

Logical operators

Logical operators are used to combine two or more relational expressions.

There are three logical operators:

Operator Meaning
&& Logical And
|| Logical or
! Logical not


The expression which combines two or more relational expressions is termed as logical expression or compound relational expression.

The result of a logical expression is either one or zero.

Example:

a) if (age > 50 && weight < 80)
b) if (a < 0 || ch = = 'a')
c) if ( ! (a < 0))

0 comments:

Copyright

Copyright © 2008 C Tutorial, All rights are reserved