Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - C programming, integer variables A and B are hexadecimal numbers of 16, how to calculate the bit sum operation of A and B?
C programming, integer variables A and B are hexadecimal numbers of 16, how to calculate the bit sum operation of A and B?
Bit and operation, first of all, a and b should be converted into binary for operation.

Such as a = 0x 15 b = 0x23.

16 binary conversion is easy. One bit of 16 binary is equivalent to four bits of binary. Make a conversion

As above, a = 000101b = 0010001.

Bit sum result a & amp; B = 0000 000 1 The result is 1.