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 2 of 2.

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.

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

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

Vinojayaraj said:   9 years ago
I agree @Linu.


Post your comments here:

Your comments will be displayed after verification.