Which bit wise operator is suitable for turning off a particular bit in a number?



Which bit wise operator is suitable for turning off a particular bit in a number?..

Answer / Braj Mohan Munduia

The bitwise NOT (~) operator or the bitwise AND with ones complement (& ~mask) can be used to turn off a particular bit in a number. If you want to clear the n-th bit, you would perform a bitwise AND with a mask that has a 1 in every position except for the n-th position.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C++ General Interview Questions

What are the four partitions in which c++ compiler divides the ram?

1 Answers  


Write a program which is required to process the time of a clock in hours and minutes, entered from the keyboard. With this program, there are two requirements for any data entered by a user: 1. The data must be of the correct type (in this case, two ints). 2. The data must be in the correct range: this means that, for the minutes, negative numbers and any number above 59 must be rejected; for the hours, negative numbers and any number above 23 must be rejected. Output error message for invalid data input. Output the time one and a half hour after the time input. i.e. Hour: 22 Min: 32 One and a half hour after 22:32 is 00:02

1 Answers  


write a corrected statement so that the instruction will work properly. if (4 < x < 11) y = 2 * x;

1 Answers  


What are c++ redistributables?

1 Answers  


How do I open binary files?

1 Answers  


what is c++

1 Answers  


Why are pointers not used in c++?

1 Answers  


What are the advantages of pointers?

1 Answers  


What is prototype for that c string function?

1 Answers  


what is object?

7 Answers  


What is a dangling pointer?

3 Answers   Glenwood,


What do you mean by internal linking and external linking in c++?

1 Answers  


Categories