**New course!**Every coder should learn

**Generative AI!**

+ 1

# Bitwise AND: 2&4 = 0 why?

Bitwise AND: 2&4 = 0 why?. If we manually convert 2 and 4 to binary and then multiply them we get answer 8.

5 Answers

+ 8

Bitwise AND handle bytes to bit level remembering than:
0 AND 0 = 0
0 AND 1 = 0
1 AND 0 = 0
1 AND 1 = 1
Then first transform the numbers into bits and procede with AND operation bit by bit:
2= 010
4= 100
________
000 = 0

+ 3

You are mixing AND with mutliplication and they are not same.. AND is a boolean operation than apply only to booleans fields (like 1/0, true/false)
It, in practice, return 1/true if and only if either values are 1/true else 0/false.

+ 2

๐๐๐

+ 1

Then what is this?
010
100
________
000
000*
010**
________
01000

+ 1

Ok thank you so much you have cleared all my doubts