Bitwise operators in C are operate on the binary version of the numbers.
For example int a=5; would have to be considered as 101.
int b=4; would be 100.
a<<2 would shift the value of a. a=10100 whose decimal value would be 20. Each left shift is equivalent to multiplying by 2. So, two shift is multiplying by 4.
Each right shift is therefore equivalent to dividing by 2.
a>>2, would change a=10100 to a=101. 20 would shift to 5.
printf(“a=%d b=%d,a&b=%d\n”,a,b,a & b);
After Running Program 🙂