What is difference between && and & similarly || and | i.e., What is difference between logical AND and bit-wise AND?

Showing Answers 1 - 3 of 3 Answers

archikinu

  • Sep 28th, 2007
 

&& , || - logical operators
 &,| - bit wise operators

Logical operators are normally used for specifying conditions.
Usage: condition1 && condition2, condition1 || condition2

Logical AND evaluates to true if both the conditions are true and logical OR evaluates to true if one of the conditions is true.

Bitwise operators perform the specified operation on bits and returns the result.

eg:
2 && 3 evaluates to true
2 & 3 gives result as 2(010 & 011)

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions