1. ## Bitwise -- b&01

Hi ,

Could you please explane to me the statment " b&01"

b=4=100 (in binary)
why 100&01 it's 0? ( and not 100)

Code:
```int b=4;
if (b&01)
{
//do somthing

}```

2. Here's the the truth table for &:
Code:
```a | b | a & b
1 | 1 |   1
1 | 0 |   0
0 | 1 |   0
0 | 0 |   0```
& is a bit operator thus you have to combine the equivalent "digits":
Code:
```1 0 0
&
0 1
-----
0 0 0```
And numbers with a leading 0 are treated as octal values in C (not relevant here, but probably in other problems).

Bye, Andreas

3. Hi Andreas

Q -1 what about regarding the 1 degit in red?
With what do I multipole the red 1 ?
1 0 0

&

0 1

Q -2
10110 ---------> ( 22 desimal)
&
000 ---------> ~( 7 desimal)
-------
10000 ---------> (16 desimal)

22&~7=16 in the example the 10 left digits are remain as they are , could you please explane?

4. You fill up the left side with zeros. It's the same principle with decimal numbers:

Code:
```1 2 3
+
4
-----
1 2 7```
is the same as

Code:
```1 2 3
+
0 0 4
-----
1 2 7```
Bye, Andreas

5. 22&~7=16 in the example the 10 left digits are remain as they are , could you please explane?
~7 does not equal zero.
It gives a value for which all but the last 3 bits are ones.