Operators Exampl e Explanation
Operators Exampl e Explanation
n
o
Arithmetic
Operators
Addition
Subtraction A-B
multiplicati
A*B
on
Division
A/B
Modulus
A%B
Operation
Explanation
+=
Compound
assignment
operators
A+B
Exampl
e
Operators
Simple assignment
operator
Example
-=
sum=10
*=
sum*=1
This is same as sum = sum*10
0
/=
sum/=1
This is same as sum = sum/10
0
sum
%=10
%=
&=
sum&=1
This is same as sum = sum&10
0
^=
sum^=1
This is same as sum = sum^10
0
S.n Operator
o
s
Name
Example
Description
&&
logical
AND
(x>5)&&(y<5)
||
logical OR
(x>=10)||
(y>=10)
logical
NOT
!
((x>5)&&(y<5))
Operator_sym Operator
bol
name
x|y
x&y
x^y
&
Bitwise_AND
Bitwise OR
Bitwise_NOT
XOR
S.no
Operators
&
Sizeof ()
<<
Left Shift
>>
Right Shift
Description
This is used to get the address of the variable.
Example : &a will give address of a.
This is used as pointer to a variable.
Example : * a where, * is pointer to the variable a.
This gives the sizeofthe variable.