0

How does (int name) >> (number); works?

Few times when I was doin' a challenge there was a question that looked like this: int x = 12; x>>2; Console.Write(x); So there's a question, how does those ">>" works?

19th Apr 2017, 8:26 AM
freyby
freyby - avatar
1 Odpowiedź
+ 8
it's a binary operator works like this: 12 = 00001100 12 >> 2 = 00001100 >> 2 = 00000011 = 3 another example: 12 >> 1 = 00001100 >> 1 = 00000110 = 6 it shifts binary numbers to right.
19th Apr 2017, 8:34 AM
Cyrus Ornob Corraya
Cyrus Ornob Corraya - avatar