C Bit Manipulation Problem

Associate
Joined
1 Mar 2010
Posts
1,389
When I perform the calculation 25441 & 0000000011111111 the answer I recieve is puzzling. Instead of the expected 97 I instead get 577.

Code:
printf( "%d", 25441 & MASK );

The output is 577 where MASK is 0000000011111111.

I performed the bitwise addition manually to double check and the answer should definitely be 97. I must have an error somewhere.

Any help is much appreciated.
 
Back
Top Bottom