bitwise left shift operator

if we left shift 35 by 4 places, we are supposed to get result ( 35 x 2 to the power 4 ) according to definition of left shift operator but I am getting a different answer. why?

binary of 35 is 00100011
00100011 << 4 will result in 00110000 which is 48 where as the result should be 35 x 16 = 560.

please somebody help me


  • If your value is in a byte (char) you loose all the bits above 255. So 35 (00100011) becomes 48 (00110000)
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion