How does >> operater works ?

Showing Answers 1 - 4 of 4 Answers

karthik

  • Nov 1st, 2005
 

It is right shift operator, which will produce divide by 2 action. For example 10>>2 will produce 5. the binary value of 10 is "1010" if we right shift the above by one position it will be "0101" this is equivalent to 5.

  Was this answer useful?  Yes

Me

  • Feb 5th, 2007
 

The post is wrong. 10 >> 2 != 5. X >> Y is the same as X / (2 ^ Y). 10 is 1010 and >> 2 is right shift two. That would result in 2 (or 10 in binary), not 5 (101 in binary).

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions