C Programming - Control Instructions - Discussion

Discussion Forum : Control Instructions - General Questions (Q.No. 3)
3.
Which of the following is not logical operator?
&
&&
||
!
Answer: Option
Explanation:

Bitwise operators:
& is a Bitwise AND operator.

Logical operators:
&& is a Logical AND operator.
|| is a Logical OR operator.
! is a NOT operator.

So, '&' is not a Logical operator.

Discussion:
14 comments Page 1 of 2.

Himansu ojha said:   5 years ago
&&,||,! are only 3 logical operators but &,|,^,>>,<<,~ are only 6 bitwise operators.
(1)

Vinojayaraj said:   8 years ago
I agree @Linu.

Pravani said:   8 years ago
'&' is a bitwise operator. '!' is unary operator. Both are not logical operator then why we choose only '&'.

Linu said:   8 years ago
The & operator is a bitwise operator.

Manu said:   1 decade ago
Hai @Vinoth. Difference is that in logical && AND operator we have the comparison of two nonzero or zero or either both combination according to the truth table of AND.

But in bitwise operator.

For ex: 10&5 write it in binary format.
1010
+
0101
-----
1010
-----

The answer is 10 for bitwise. But for logical and the value is 1 because both are non zero numbers.

Arun said:   1 decade ago
When we are working on bitwise operator it will manipulate the data direct on binary representation.

Akhilesh kumar said:   1 decade ago
& is a bitwise AND operator.

Pandi said:   1 decade ago
@Tata p.

Put like this a>=5?(b=100):(c=100);

Iiittarun1625 said:   1 decade ago
Bitwise operators are &,|,^
Logical operators are logical and (&&),logical or(||)
so & is not logical operator

Tata p said:   1 decade ago
Can anyone tell me why it is giving lvalue required
a>=5?b=100:c=200


Post your comments here:

Your comments will be displayed after verification.