0% found this document useful (0 votes)
24 views

Operators Exampl e Explanation

The document describes various arithmetic, logical, assignment, and bitwise operators in C/C++. Arithmetic operators include addition, subtraction, multiplication, division, and modulus. Logical operators include AND, OR, and NOT. Assignment operators comprise simple assignment and compound assignment using operators like +=, -=, etc. Bitwise operators manipulate bits within a character or integer.

Uploaded by

elasu85
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views

Operators Exampl e Explanation

The document describes various arithmetic, logical, assignment, and bitwise operators in C/C++. Arithmetic operators include addition, subtraction, multiplication, division, and modulus. Logical operators include AND, OR, and NOT. Assignment operators comprise simple assignment and compound assignment using operators like +=, -=, etc. Bitwise operators manipulate bits within a character or integer.

Uploaded by

elasu85
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

S.

n
o

Arithmetic
Operators

Addition

Subtraction A-B

multiplicati
A*B
on

Division

A/B

Modulus

A%B

Operation

Explanation

sum=10 10 is assigned to variable sum


sum+=1 This_is_same_as_sum=sum+10
0

+=

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

%=

This is same as sum = sum-10

This is same as sum = 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)

It returns true when both conditions are true

||

logical OR

(x>=10)||
(y>=10)

It returns true when at-least one of the condition


is true

logical
NOT

!
((x>5)&&(y<5))

It reverses the state of the operand ((x>5) &&


(y<5))
If ((x>5) && (y<5)) is true, logical NOT
operator makes it false

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.

Example : sizeof(char) will give us 1.

You might also like