06 Operators
06 Operators
Session 6
Terms To Remember
Expression
Operands
Operators in C
Operators
Arithmetic Malicious
Increment /
Assignment
decrement
Logical
Definitions Operator Classifications
Operator Operation
== Is equal to
< less than
> Greater than
<= Less than or equal to
>= Greater than or equal to
!= Not eqaul to
Logical Operators
• These operators are used to combine two simple
conditions. Logical expressions are also called
compound conditions
Operator Operation
&& And: combines two simple cond’s into a
compound cond., such that the compound
cond., is true only when both the simple
cond’s are true
|| Or : combines two simple cond’s into a
compound cond., such that the compound
cond., is true when at least one of the simple
cond’s is true
! Not: is used to nagate a simple cond.
Ternary Pair Operator
• ~ is defined as
– ~1 = 0
– ~0 = 1
• Example: unsigned int a,b; a=4; b=~a;
~~~~ ~~~~ ~~~~ ~~~~
• a in binary is 0000 0000 0000 0100 =4
==== ==== ==== ====
• b in binary is 1111 1111 1111 1011 =65531