# 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
Explanation:
No answer description is available. Let's discuss.
Discussion:
41 comments Page 1 of 5.

Nag raj said:   2 years ago
Bit-wise AND operator is able to mask a particular bit.

Eg: Let us take 15 (decimal).
--->1111 (binary).

If we want 3rd bit only then simply mask the given number with 1000 by using bit-wise AND.
1111 (given number).

---- - (bit-wise AND operation).
1000 (required result).
(4)

Ruhi said:   6 years ago
Thanks all for explaining this.
(2)

Anusha said:   7 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)

Gafoor said:   7 years ago
how to work & operator in the program?

Can anyone explain with an example, please?
(2)

Sateesh said:   7 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.

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

Emanuel said:   8 years ago
I think ^ operator.

Pritam said:   8 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.

Deepak_Bboy said:   8 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.
(1)

Simanta said:   9 years ago
For an example:

int a,b,c;
a=5;
b=6;
c=a&&b;

//In this situation when a and b having any -ve or +ve value.

Then it is taken as 1. So c = 1 && 1=1. Rather then '0' all value are taken as 1.

d = a & b; //In this situation the operation is perform between every binary bit of a and b. So a = 5 = 101.

b = 6 = 110 so d = 100 = 4.

That is why '&&' called logical operator and '&' called bit-wise operator.
(1)