C Programming - Bitwise Operators - Discussion

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

Vanitha said:   1 decade ago
Let me explain the answer.

The input value is 255 00000000 11111111

If we want to turn on the 10th bit means

The turn of value is 00000010 00000000

00000000 11111111
00000010 00000000 | operation
------------------
00000010 11111111
------------------

If we want to on particular bit OR operation is performed.
(2)

Rajendra Acharya said:   1 decade ago
In bitwise operator we are comparing in between 2 digits.

Ex : 1|0 = 1.

But in logical operator we are comparing in between two conditions/ 2 values.

Ex : 1||1 = 1.

Kanagaraj said:   1 decade ago
Any one can explain simple masking program?

Dhananjay said:   7 years ago
int a=8,b=2; printf("%d",a>>b); explain.


Post your comments here:

Your comments will be displayed after verification.