C Programming - Bitwise Operators - Discussion

Discussion Forum : Bitwise Operators - General Questions (Q.No. 2)
2.
Which bitwise operator is suitable for turning off a particular bit in a number?
&& operator
& operator
|| operator
! operator
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
41 comments Page 2 of 5.

Deepak_Bboy said:   10 years ago
AND.

0 & 0 = 0 OFF.
1 & 0 = 0 OFF.

OR.

X & 0 = 0 OFF.

OR.

Input & 0 = 0 OFF.

BUT OR.

0| 0 = 0.
0| 1 = 1.
1| 0 = 1.
1| 1 = 1.

You can't OFF a 1 (input).

As you can see above.
(2)

Pritam said:   10 years ago
If we read question carefully what I understood is that if I want to turn off the bit.

i.e First bit is on means 1. To turn off it I use negation so that it will turn off.
(1)

Arjun Prasad said:   1 decade ago
To make above operand you take a number 1 and then shift its only set bit to the number of the bit you want to turn off(1<<3) and then take AND with given number.

Sudheer said:   1 decade ago
Hai friends I am new to C language programming I am unable to understand the logics in this languages in bitwise operation can any explain this in simple way please?

Saiprabha said:   1 decade ago
If you want to off the bit means u want to make it ZERO it is possible in only & condition because
in & if 1 1 o/p-1
else 0

Anusha said:   8 years ago
! operator makes the non zero number into zero.
thus (!52)=0,!65=0,...........
but ! (0)=1
why don't the answer is ! operator?

Can anyone explain?
(5)

Suhas . u said:   1 decade ago
Which bit u want make 0 ...make only that bit 0 n allother bits 1...
ex:-to make 3rd bit 0 use &operator with one operand as11110111

Sateesh said:   8 years ago
I think whether in AND case both are true then only particle turned on. So I think OR case is the correct answer.

Anyone explain it.

Athi said:   1 decade ago
I have 1 doubt please tell me how to find the status of a bit ie char s[50];

Then write a c program to find the status of 170th bit.

Shanme said:   9 years ago
Simply we can say, on the given option everything is logical operator, the only bitwise operator is &,

So answer &.


Post your comments here:

Your comments will be displayed after verification.