C Programming - Bitwise Operators - Discussion

Discussion Forum : Bitwise Operators - Yes / No Questions (Q.No. 1)
1.
Bitwise & can be used in conjunction with ~ operator to turn off 1 or more bits in a number.
Yes
No
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
8 comments Page 1 of 1.

Pavan sai said:   6 years ago
Here, the mask value is nothing but a number which is used to convert the given bits into the required way.

Let us take above example 11100111 is mask value.

Let us take another example, if we want to turn off the third bit from the rightmost of number 10011100 then;

10011100 &
11111011
--------------
10011000
----------
Here the mask value is 11111011.

Manoj said:   9 years ago
Can anyone just tell me about what is masking?

Prakrati said:   1 decade ago
Why just change the mask value.

Pooja said:   1 decade ago
But we can't turnoff leftmost bit & 3rd bit from right here without using ~ operator.

Preeti said:   1 decade ago
We can turn off one or more bits in a number using bitwise & no need of ~ operator.

For example, Let a number 10011100

Now we want to turn its 4th nd 5th bit off, then we can do dis using & operator as

10011100 &
11100111
--------------
10000100
--------------

So in result 4th nd 5th bit are turned off.

Sreedevi said:   1 decade ago
I need a description for this question.

Sneha said:   1 decade ago
Should we negate the number first and then and it to turn it off?

Sneha said:   1 decade ago
Someone explain.

Post your comments here:

Your comments will be displayed after verification.