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?
Discussion:
41 comments Page 2 of 5.
Heena said:
1 decade ago
Because && is a logical operator not a bitwise (bitwise is a operator that takes single bit at a time).
Bari said:
1 decade ago
Please explain about bitwise operator?
Bari said:
1 decade ago
How to work bitwise ?
Vinod Basi said:
1 decade ago
Sorry, I know this is an outdated thread... But just saw Mr.Gaurav's doubt to be one which I had a days back.
Here is a simple explanation, correct me if am wrong.
@Saurav
Its like && and || are logical operators, evaluting true statements.
Eg:
Sachin && Sehwag opens batting, It returns true(1) only if both the guys are present to open the game. Else False(0)
Sachin || Sehwag, return true(1), if either Sachin or Sehwag accompanied by someone else opens the game. Else false(0)
& and | are bitwise operators, High and Low
AND, OR gates truth table pretty much explains it.
Eg:
2 & 3 (AND)
010
&
011
------
010
2 | 3 (OR)
010
|
011
------
011
Bitwise operators can be predominantely found in Embedded design, to find the status (ON or OFF) of a bit in a system.
Hope this explains...
Cheers...
Here is a simple explanation, correct me if am wrong.
@Saurav
Its like && and || are logical operators, evaluting true statements.
Eg:
Sachin && Sehwag opens batting, It returns true(1) only if both the guys are present to open the game. Else False(0)
Sachin || Sehwag, return true(1), if either Sachin or Sehwag accompanied by someone else opens the game. Else false(0)
& and | are bitwise operators, High and Low
AND, OR gates truth table pretty much explains it.
Eg:
2 & 3 (AND)
010
&
011
------
010
2 | 3 (OR)
010
|
011
------
011
Bitwise operators can be predominantely found in Embedded design, to find the status (ON or OFF) of a bit in a system.
Hope this explains...
Cheers...
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.
Then write a c program to find the status of 170th bit.
Satyaprakash said:
1 decade ago
Turn off operator in bitwise operators is and because it turns 1&0 and 0&1 into turn off(that is o). |(OR) bitwise turns preceeded operations into turn on(that is 1).
Hence AND IS turn off operator.
Hence AND IS turn off operator.
Naveen kumar ramisetty said:
1 decade ago
Thanks ramya.
Deepanwita said:
1 decade ago
Bitwise operator is more easily been applied than the logical operator.
Mouni said:
1 decade ago
Please explain how to convert hexa decimal into binary.
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
in & if 1 1 o/p-1
else 0
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers