TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Interviews
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
.NET
ADO.NET
Android
ASP.NET
C#
Databases & DBA
Design Patterns & Practices
iOS
Java
OOP/OOD
SharePoint
Software Testing
Web Development
WPF
View All
Which bitwise operator is suitable for checking whether a particular bit is ON or OFF?
By
Tripti Tiwari
in
C, C++, MFC
on
Oct 04
2013
1
2.9k
3
Post Your Answer
Submit
Sep, 2017
4
&
0
Jun, 2015
10
Bitwise And operator
0
Oct, 2013
4
Bitwise AND operator.
Example: Suppose in byte that has a value 10101101 . We wish to check whether bit number 3 is ON (1) or OFF
(0) . Since we want to check the bit number 3, the second operand for AND operation we choose is binary
00001000, which is equal to 8 in decimal.
Explanation:
ANDing operation :
10101101 original bit pattern
00001000 AND mask
---------
00001000 resulting bit pattern
---------
The resulting value we get in this case is 8, i.e. the value of the second operand. The result turned out to be a 8
since the third bit of operand was ON. Had it been OFF, the bit number 3 in the resulting bit pattern would have
evaluated to 0 and complete bit pattern would have been 00000000. Thus depending upon the bit number to be
checked in the first operand we decide the second operand, and on ANDing these two operands the result
decides whether the bit was ON or OFF.
0
What is an Enumeration Constant?
What are the advantages of unions?
Most Popular Job Functions
Developer (1609)
Programmer (1253)
Senior Management (1222)
Sr. Developer (666)
Sr. Programmer (432)
Fresher (402)
Tech Lead (265)
DBA (245)
Team Lead (189)
Project Lead (86)
View All
MOST LIKED QUESTIONS
What are the advantages of using REST in Web API?
Why do you want to leave your current company?
A class provides a default constructor for me. I write a constructor that takes a string as...
Which Is Faster MVC or ASP.net ?
What is file extension of Webservices in .Net?
What is ASP.NET Core?
.NET interview questions :- Can you explain architecture of your project ?
In which situation(s), the use of "Delegate" is a good idea?
What is a View ?Can we insert,Update and delete a view?
What is the difference between Convert.ToString() and .ToString()?