C Programming - Bitwise Operators - Discussion
|
|
|
|
Read more:"You cannot shake hands with a clenched fist."
- Indira Gandhi
|
| 3. |
Which bitwise operator is suitable for turning on a particular bit in a number? |
| [A]. |
&& operator | [B]. |
& operator | | [C]. |
|| operator | [D]. |
| operator |
Answer: Option A
Explanation:
No answer description available for this question.
|
|
Samanth said:
(Thu, Jun 10, 2010 06:39:10 AM)
|
|
| |
| Can you tellme how? |
|
Namo said:
(Tue, Aug 17, 2010 04:58:06 PM)
|
|
| |
"|" this operator is known as OR operator
and
we know that with or operator
1| 0 = 1
1| 1 = 1
that's why here we use or operator |
|
Deepshikha said:
(Tue, Dec 7, 2010 12:18:20 PM)
|
|
| |
| Namo is correct. |
|
Slave Of The Eternal said:
(Thu, Feb 17, 2011 06:10:10 AM)
|
|
| |
| Well said namo. |
|
Anji said:
(Wed, Apr 6, 2011 04:49:42 AM)
|
|
| |
Why you did't think like this?
1& 0=0.
1& 1=1. |
|
Join2Piyush said:
(Thu, Apr 21, 2011 02:05:24 AM)
|
|
| |
Anji here you take input as 1 & we want output 1 i.e. on.
But when our input is 0 & we want output as 1 I. E. On.
At that time if we & with 1 or & with 0 output will be always 0.
That's why we hav 2 use | to on the bit. |
|
Parul said:
(Tue, Jun 14, 2011 07:46:01 AM)
|
|
| |
| Nano is absolutely correct. My doubt is clear now. |
|
Rupa said:
(Sun, Jul 3, 2011 11:41:04 AM)
|
|
| |
| But when 0|0=0 so how to turn on this? |
|
Amrendra said:
(Tue, Aug 16, 2011 07:49:59 PM)
|
|
| |
@Rupa:.
If input is 0, you have to use 1 i.e. 0|1=1. |
|
Vijay Arora said:
(Thu, Aug 18, 2011 08:00:53 PM)
|
|
| |
Best use of the & operator is to check whether a particular bit od an operand is ON or OFF.
Why, we are not using &. ? |
|
Mansi said:
(Mon, Aug 29, 2011 02:44:57 PM)
|
|
| |
| If | is OR operator than what do we call || operator as? |
|
Swetha said:
(Wed, Sep 14, 2011 08:59:31 PM)
|
|
| |
@Namo
You are right and its easily understandable. |
|
Viny said:
(Mon, Sep 19, 2011 03:15:28 PM)
|
|
| |
| Namo is correct. |
|
Datta said:
(Wed, Oct 5, 2011 09:53:53 AM)
|
|
| |
Logical OR ||
Ex: if(a || b) { ... }
Bitwise OR |
Ex: result = a | b; |
|
Swapna said:
(Thu, Oct 13, 2011 02:05:56 PM)
|
|
| |
| || it will call as logical OR.here OR truth table is true false=true, true true=true.so here OR operator is on a particular bit in a number. |
|
|