I am not sure how this right shift is equal to 0: I understand how shifting works but why does the author say it equals in binary zero but a different result in decimal? Isn't binary zero the same as decimal zero?
0000
Also how does it even equal binary zero?
unsigned int value = 65372U;
As a binary value in a 2-byte variable, this is:
1111 1111 0101 1100
Suppose you now execute the following statement:
unsigned int result = value >> 2; /* Shift right two bits */
The bits in value will be shifted two places to the right, introducing zeros at the left end, and the resultant value will be stored in result. In binary this will be 0, which is the decimal value 16343.
0011 1111 1101 0111