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.

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

So answer &.

Nkandu said:   10 years ago
I am new to c programming I don't understand it can someone please help me.

Apshana said:   1 decade ago
Why && will not be answer? And tell me what is the difference between & and &&?

Sudha said:   1 decade ago
And operator follow a multiple mechanism. So Zero the position will be off, the OR operator addition mechanism.

Mallikarjun said:   1 decade ago
Bitwise & is used for masking bits i.e 1 can be done 0.

Ranjana said:   1 decade ago
Any bit AND(&) with 0 will give a zero .i.e. will turn that particular bit OFF.

Ajarmani said:   1 decade ago
@Sudheer.

The basics of bitwise operation is:
1 & 1 = 1
1 & 0 = 0
0 & 1 = 0
0 & 0 = 0

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

Using this we will solve an example.

5 & 3
1.Convert to binary
101 & 011.

2. Now apply bitwise operation:
1 0 1 = 5
& & &
0 1 1 = 3
_____
0 0 1 = 1

Hence 5 & 3 = 1.

Kannan P said:   1 decade ago
Given 4 option A and C not a bit-wise operator. B and D is a bit-wise operator. If you use D it will totally changed the values in high to low and low to high. But use & operator mask bit. We can change where ever you want.

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?

Umesh said:   1 decade ago
How to convert hexadecimal into binary?

Answer:

1) Take the hexa decimal no. and calculate it decimal value first.

2) Convert decimal number into binary having 4 digit.

3) Repeat 1 and 2 until number is not end.

e.g.

A2F for A decimal is 10.

and 10 = 1010 in binary in the same way.
2 = 2 in decimal and in binary 0010.
F = 15 in decimal and in binary 1111.

So Hexa(A2F) = Binary (1010 0010 1111).


Post your comments here:

Your comments will be displayed after verification.