SlideShare a Scribd company logo
www.eshikshak.co.in
● An operator used for manipulation of data
   at bit level
 ● It is used for testing bits, shifting them
   right or left
 ● It works on integer and character data
   type
 ● It is not applied to float or double



www.eshikshak.co.in
Operator Meaning
~       One’s compliment
>>      Shift right
<<      Shift left
&       Bitwise AND
|       Bitwise OR
^       Bitwise exclusive OR




            www.eshikshak.co.in
● All the 1’s present in the number are changed to
   0’s and all 0’s are changed to 1’s

 ● Example
   1’s complement of 1101 = 0010
   1’s complement of 1010 = 0101




www.eshikshak.co.in
main()
{
int j,k;
j=12;
k=~j;
printf(“One’s complement of %d is”,j);
showbits(k);
}

Example
One’s complement of 12 is 0011




www.eshikshak.co.in
● It is represent by >>
 ● It shifts each bit in operand to the right
 ● Example
   ch >> 1
    This will shift all bits in ch one place to the right
ch >> 5
This will shift all bits in ch five places to the right



www.eshikshak.co.in
main()
{
int j,k,i;
i=12;
for(j=0;j<4;j++)
{
k = i >> j;
printf(“%d right shift %d gives”,i,j);
showbits(k);
}
}
Output
12 right shift 0 gives 1100
12 right shift 1 gives 0110
12 right shift 2 gives 0011
12 right shift 3 gives 0001




www.eshikshak.co.in
● It is represent by <<
 ● It shifts each bit in operand to the left
 ● Example
   ch << 1
    This will shift all bits in ch one place to the left
ch << 5
This will shift all bits in ch five places to the left



www.eshikshak.co.in
main()
{
int j,k,i;
i= 3;
for(j=0;j<4;j++)
{
k = i << j;
printf(“%d right shift %d gives”,i,j);
showbits(k);
}
}
Output
12 right shift 0 gives 0011
12 right shift 1 gives 0001
12 right shift 2 gives 0000
12 right shift 3 gives 0000




www.eshikshak.co.in
● & operator operates on two operands
● This operator will compared two operands on
  bit-by-bit basis
● Both the operands must be of same type
  (either char or int)
● & and && are different operator, && is logical AND operator whereas & is
  Bitwise AND operator


                 1st Bit        2nd Bit          1st & 2nd Bit
                 0              0                0
                 0              1                0
                 1              0                0
                 1              1                1


                           www.eshikshak.co.in
● The uses of bitwise AND operator

    a) It is used whether a particular bit in a number is ON
    or OFF
b) It is used to turn OFF a particular bit in a number




                    www.eshikshak.co.in
www.eshikshak.co.in

More Related Content

Viewers also liked (20)

PPTX
principle of oop’s in cpp
gourav kottawar
 
PPT
3) web development
techbed
 
PPT
7) packaging and deployment
techbed
 
PPT
Web Applications and Deployment
BG Java EE Course
 
PPT
Inheritance C#
Raghuveer Guthikonda
 
PPTX
Array and string
prashant chelani
 
PPT
Parm
parmsidhu
 
PPT
WebLogic Deployment Plan Example
James Bayer
 
PPTX
Graphics in C programming
Kamal Acharya
 
PPTX
Inheritance, friend function, virtual function, polymorphism
Jawad Khan
 
PPT
Structures
archikabhatia
 
PPT
Lec 42.43 - virtual.functions
Princess Sam
 
PPT
C++ Language
Syed Zaid Irshad
 
DOCX
Virtual function
harman kaur
 
PPTX
Functions in C
Shobhit Upadhyay
 
PPT
Embedded c programming22 for fdp
Pradeep Kumar TS
 
PDF
Constructors and Destructors
Dr Sukhpal Singh Gill
 
PPTX
C pointer
University of Potsdam
 
PPTX
Function in c
Raj Tandukar
 
PPTX
operator overloading & type conversion in cpp over view || c++
gourav kottawar
 
principle of oop’s in cpp
gourav kottawar
 
3) web development
techbed
 
7) packaging and deployment
techbed
 
Web Applications and Deployment
BG Java EE Course
 
Inheritance C#
Raghuveer Guthikonda
 
Array and string
prashant chelani
 
Parm
parmsidhu
 
WebLogic Deployment Plan Example
James Bayer
 
Graphics in C programming
Kamal Acharya
 
Inheritance, friend function, virtual function, polymorphism
Jawad Khan
 
Structures
archikabhatia
 
Lec 42.43 - virtual.functions
Princess Sam
 
C++ Language
Syed Zaid Irshad
 
Virtual function
harman kaur
 
Functions in C
Shobhit Upadhyay
 
Embedded c programming22 for fdp
Pradeep Kumar TS
 
Constructors and Destructors
Dr Sukhpal Singh Gill
 
Function in c
Raj Tandukar
 
operator overloading & type conversion in cpp over view || c++
gourav kottawar
 

Similar to Lecture 11 bitwise_operator (20)

PPTX
Cse lecture-4.2-c bit wise operators and expression
FarshidKhan
 
PDF
Bitwise Operations(1).pdf
DalvinCalvin
 
PPTX
Explanation and importance of Bitwiseoperator.pptx
pratyushghimire193
 
PPT
Bitwise Operators in C
yndaravind
 
PDF
Nayanggggffggggdsdgghbgggvggggggggggg.pdf
narayanchdas898
 
PPTX
Bitwise operators
Megha Sharma
 
PPTX
Unit 4. Operators and Expression
Ashim Lamichhane
 
PDF
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 2 of 5 by...
ssuserd6b1fd
 
PPTX
Bit manipulation
UthraSowrirajan1
 
DOC
Report on c
jasmeen kr
 
PPT
Java 2
Preethi Nambiar
 
PPT
Java - Operators
Preethi Nambiar
 
PPTX
btwggggggggggggggggggggggggggggggisop correct (1).pptx
Orin18
 
PPTX
Bit-Manipulation for competitive programming
gaurav77712
 
PPTX
C operators
Rupanshi rawat
 
PPTX
Operators in C & C++ Language
PreSolutions Softwares
 
PDF
Lecture 35 and 36 Bitwise Operators.pdf
Ubaidurrehman997675
 
PPT
Mesics lecture 4 c operators and experssions
eShikshak
 
PPTX
bit wise operators and I/O operations in C
preetikapri1
 
PPTX
Computer programming 2 Lesson 7
MLG College of Learning, Inc
 
Cse lecture-4.2-c bit wise operators and expression
FarshidKhan
 
Bitwise Operations(1).pdf
DalvinCalvin
 
Explanation and importance of Bitwiseoperator.pptx
pratyushghimire193
 
Bitwise Operators in C
yndaravind
 
Nayanggggffggggdsdgghbgggvggggggggggg.pdf
narayanchdas898
 
Bitwise operators
Megha Sharma
 
Unit 4. Operators and Expression
Ashim Lamichhane
 
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 2 of 5 by...
ssuserd6b1fd
 
Bit manipulation
UthraSowrirajan1
 
Report on c
jasmeen kr
 
Java - Operators
Preethi Nambiar
 
btwggggggggggggggggggggggggggggggisop correct (1).pptx
Orin18
 
Bit-Manipulation for competitive programming
gaurav77712
 
C operators
Rupanshi rawat
 
Operators in C & C++ Language
PreSolutions Softwares
 
Lecture 35 and 36 Bitwise Operators.pdf
Ubaidurrehman997675
 
Mesics lecture 4 c operators and experssions
eShikshak
 
bit wise operators and I/O operations in C
preetikapri1
 
Computer programming 2 Lesson 7
MLG College of Learning, Inc
 
Ad

More from eShikshak (20)

PDF
Modelling and evaluation
eShikshak
 
PDF
Operators in python
eShikshak
 
PDF
Datatypes in python
eShikshak
 
PDF
Introduction to python
eShikshak
 
PPT
Introduction to e commerce
eShikshak
 
PDF
Chapeter 2 introduction to cloud computing
eShikshak
 
PDF
Unit 1.4 working of cloud computing
eShikshak
 
PDF
Unit 1.3 types of cloud
eShikshak
 
PDF
Unit 1.2 move to cloud computing
eShikshak
 
PDF
Unit 1.1 introduction to cloud computing
eShikshak
 
PPT
Mesics lecture files in 'c'
eShikshak
 
PPT
Mesics lecture 8 arrays in 'c'
eShikshak
 
PPT
Mesics lecture 7 iteration and repetitive executions
eShikshak
 
PPT
Mesics lecture 5 input – output in ‘c’
eShikshak
 
PPT
Mesics lecture 6 control statement = if -else if__else
eShikshak
 
PPT
Mesics lecture 5 input – output in ‘c’
eShikshak
 
PPT
Mesics lecture 3 c – constants and variables
eShikshak
 
PDF
Lecture 7 relational_and_logical_operators
eShikshak
 
PDF
Lecture21 categoriesof userdefinedfunctions.ppt
eShikshak
 
PDF
Lecture20 user definedfunctions.ppt
eShikshak
 
Modelling and evaluation
eShikshak
 
Operators in python
eShikshak
 
Datatypes in python
eShikshak
 
Introduction to python
eShikshak
 
Introduction to e commerce
eShikshak
 
Chapeter 2 introduction to cloud computing
eShikshak
 
Unit 1.4 working of cloud computing
eShikshak
 
Unit 1.3 types of cloud
eShikshak
 
Unit 1.2 move to cloud computing
eShikshak
 
Unit 1.1 introduction to cloud computing
eShikshak
 
Mesics lecture files in 'c'
eShikshak
 
Mesics lecture 8 arrays in 'c'
eShikshak
 
Mesics lecture 7 iteration and repetitive executions
eShikshak
 
Mesics lecture 5 input – output in ‘c’
eShikshak
 
Mesics lecture 6 control statement = if -else if__else
eShikshak
 
Mesics lecture 5 input – output in ‘c’
eShikshak
 
Mesics lecture 3 c – constants and variables
eShikshak
 
Lecture 7 relational_and_logical_operators
eShikshak
 
Lecture21 categoriesof userdefinedfunctions.ppt
eShikshak
 
Lecture20 user definedfunctions.ppt
eShikshak
 
Ad

Recently uploaded (20)

PPTX
Technical Analysis of 1st Generation Biofuel Feedstocks - 25th June 2025
TOFPIK
 
PDF
Rostyslav Chayka: Управління командою за допомогою AI (UA)
Lviv Startup Club
 
PDF
15 Essential Cloud Podcasts Every Tech Professional Should Know in 2025
Amnic
 
PPTX
Hackathon - Technology - Idea Submission Template -HackerEarth.pptx
nanster236
 
PDF
Buy Boys Long Sleeve T-shirts at Port 213
Port 213
 
PDF
SUMMER SAFETY FLYER SPECIAL Q3 - 16 Pages
One Source Industrial Supplies
 
PPTX
2025 July - ABM for B2B in Hubspot - Demand Gen HUG.pptx
mjenkins13
 
PDF
kcb-group-plc-2024-integrated-report-and-financial-statements (3).pdf
DanielNdegwa10
 
PDF
Jordan Minnesota City Codes and Ordinances
Forklift Trucks in Minnesota
 
PPTX
Build Wealth & Protect Your Legacy with Indexed Universal Life Insurance
iulfinancial6
 
PDF
Gabino Barbosa - A Master Of Efficiency
Gabino Barbosa
 
PDF
NewBase 07 July 2025 Energy News issue - 1800 by Khaled Al Awadi_compressed.pdf
Khaled Al Awadi
 
PPTX
World First Cardiovascular & Thoracic CT Scanner
arineta37
 
DOCX
RECLAIM STOLEN CRYPTO REVIEW WITH RECUVA HACKER SOLUTIONS
camilamichaelj7
 
PPTX
Washington University of Health and Science A Choice You Can Trust
Washington University of Health and Science
 
PPTX
GE%205.pptx BUSINESS EMAIL this report aims
KenSantos27
 
PDF
Azumah Resources reaffirms commitment to Ghana amid dispute with Engineers & ...
Kweku Zurek
 
PDF
Securiport - A Global Leader
Securiport
 
PDF
Top Farewell Gifts for Seniors Under.pdf
ThreadVibe Living
 
PDF
From Legacy to Velocity: how we rebuilt everything in 8 months.
Product-Tech Team
 
Technical Analysis of 1st Generation Biofuel Feedstocks - 25th June 2025
TOFPIK
 
Rostyslav Chayka: Управління командою за допомогою AI (UA)
Lviv Startup Club
 
15 Essential Cloud Podcasts Every Tech Professional Should Know in 2025
Amnic
 
Hackathon - Technology - Idea Submission Template -HackerEarth.pptx
nanster236
 
Buy Boys Long Sleeve T-shirts at Port 213
Port 213
 
SUMMER SAFETY FLYER SPECIAL Q3 - 16 Pages
One Source Industrial Supplies
 
2025 July - ABM for B2B in Hubspot - Demand Gen HUG.pptx
mjenkins13
 
kcb-group-plc-2024-integrated-report-and-financial-statements (3).pdf
DanielNdegwa10
 
Jordan Minnesota City Codes and Ordinances
Forklift Trucks in Minnesota
 
Build Wealth & Protect Your Legacy with Indexed Universal Life Insurance
iulfinancial6
 
Gabino Barbosa - A Master Of Efficiency
Gabino Barbosa
 
NewBase 07 July 2025 Energy News issue - 1800 by Khaled Al Awadi_compressed.pdf
Khaled Al Awadi
 
World First Cardiovascular & Thoracic CT Scanner
arineta37
 
RECLAIM STOLEN CRYPTO REVIEW WITH RECUVA HACKER SOLUTIONS
camilamichaelj7
 
Washington University of Health and Science A Choice You Can Trust
Washington University of Health and Science
 
GE%205.pptx BUSINESS EMAIL this report aims
KenSantos27
 
Azumah Resources reaffirms commitment to Ghana amid dispute with Engineers & ...
Kweku Zurek
 
Securiport - A Global Leader
Securiport
 
Top Farewell Gifts for Seniors Under.pdf
ThreadVibe Living
 
From Legacy to Velocity: how we rebuilt everything in 8 months.
Product-Tech Team
 

Lecture 11 bitwise_operator

  • 2. ● An operator used for manipulation of data at bit level ● It is used for testing bits, shifting them right or left ● It works on integer and character data type ● It is not applied to float or double www.eshikshak.co.in
  • 3. Operator Meaning ~ One’s compliment >> Shift right << Shift left & Bitwise AND | Bitwise OR ^ Bitwise exclusive OR www.eshikshak.co.in
  • 4. ● All the 1’s present in the number are changed to 0’s and all 0’s are changed to 1’s ● Example 1’s complement of 1101 = 0010 1’s complement of 1010 = 0101 www.eshikshak.co.in
  • 5. main() { int j,k; j=12; k=~j; printf(“One’s complement of %d is”,j); showbits(k); } Example One’s complement of 12 is 0011 www.eshikshak.co.in
  • 6. ● It is represent by >> ● It shifts each bit in operand to the right ● Example ch >> 1 This will shift all bits in ch one place to the right ch >> 5 This will shift all bits in ch five places to the right www.eshikshak.co.in
  • 7. main() { int j,k,i; i=12; for(j=0;j<4;j++) { k = i >> j; printf(“%d right shift %d gives”,i,j); showbits(k); } } Output 12 right shift 0 gives 1100 12 right shift 1 gives 0110 12 right shift 2 gives 0011 12 right shift 3 gives 0001 www.eshikshak.co.in
  • 8. ● It is represent by << ● It shifts each bit in operand to the left ● Example ch << 1 This will shift all bits in ch one place to the left ch << 5 This will shift all bits in ch five places to the left www.eshikshak.co.in
  • 9. main() { int j,k,i; i= 3; for(j=0;j<4;j++) { k = i << j; printf(“%d right shift %d gives”,i,j); showbits(k); } } Output 12 right shift 0 gives 0011 12 right shift 1 gives 0001 12 right shift 2 gives 0000 12 right shift 3 gives 0000 www.eshikshak.co.in
  • 10. ● & operator operates on two operands ● This operator will compared two operands on bit-by-bit basis ● Both the operands must be of same type (either char or int) ● & and && are different operator, && is logical AND operator whereas & is Bitwise AND operator 1st Bit 2nd Bit 1st & 2nd Bit 0 0 0 0 1 0 1 0 0 1 1 1 www.eshikshak.co.in
  • 11. ● The uses of bitwise AND operator a) It is used whether a particular bit in a number is ON or OFF b) It is used to turn OFF a particular bit in a number www.eshikshak.co.in