What does the >> operator do? For example, what does the following operation 10 >> 1 = 5 do?
>>
10 >> 1 = 5
Its the right shift operator.
right shift
10 in binary is 1010 now >> 1 says to right shift by 1, effectively loosing the least significant bit to give 101, which is 5 represented in binary.
10
1010
>> 1
1
101
5
In effect it divides the number by 2.
divides
2