2. An operator is a symbol that causesAn operator is a symbol that causes
specific mathematical or logicalspecific mathematical or logical
manipulations to be performed.manipulations to be performed.
An operator is a function which is appliedAn operator is a function which is applied
to operands to obtain a resultto operands to obtain a result
c = a + b
Plus Operator
which will Produce
addition of A and
B
C OperatorsC Operators
4. Assignment operatorAssignment operator
The “equal to” symbol (=) is called asThe “equal to” symbol (=) is called as
assignment operator. it is used to assignassignment operator. it is used to assign
a value to a variable.a value to a variable.
It assigns the value of the expression onIt assigns the value of the expression on
its right side to the variable on its leftits right side to the variable on its left
side.side.
a = 10;
C OperatorsC Operators
5. Arithmetic OperatorsArithmetic Operators
• AdditionAddition c = a + bc = a + b
• SubtractionSubtraction c = a - bc = a - b
• MultiplicationMultiplication c = a * bc = a * b
• DivisionDivision c = a / bc = a / b
• RemainderRemainder c = a % bc = a % b
C OperatorsC Operators
6. Relational (Comparison) OperatorsRelational (Comparison) Operators
The relational operators are used to test orThe relational operators are used to test or
compare the value between two operands.compare the value between two operands.
>> Greater thanGreater than
<< Less thanLess than
>=>= Greater than or equal toGreater than or equal to
<=<= Less than or equal toLess than or equal to
! =! = Not equal toNot equal to
== == EqualityEquality
C OperatorsC Operators
7. Increment and decrement operatorsIncrement and decrement operators
++++ increases variable value by 1increases variable value by 1
---- decreases variable value by 1decreases variable value by 1
SyntaxSyntax
a++; //increase ‘a’ by 1//increase ‘a’ by 1
a--; //decrease ‘a’ by 1//decrease ‘a’ by 1
C OperatorsC Operators
8. Logical operatorsLogical operators
Logical operators are used to combineLogical operators are used to combine
two or more relations. The logicaltwo or more relations. The logical
operators are called Boolean operatorsoperators are called Boolean operators
because the tests between values arebecause the tests between values are
reduced to either true or false.reduced to either true or false.
OperatorOperator DescriptionDescription
• &&&& ANDAND
• |||| OROR
• !! NOTNOT
C OperatorsC Operators