shift operator in c# (<<) and (>>) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 18

shift operator in c# (<<) and (>>)

hello can someone please explain the shift operator? I don't get it.

11th Mar 2017, 5:54 PM
‎‏‎‏‎Joe
‎‏‎‏‎Joe - avatar
6 Answers
+ 17
It moves the bits of a binary number in a certain direction. So 1101 >> 2 becomes 0011 and 1101 << 2 becomes 0100
11th Mar 2017, 7:14 PM
Jafca
Jafca - avatar
+ 7
<< is use when printing out something to the console >> is use when you reading whatever the user enter
11th Mar 2017, 6:00 PM
chris
chris - avatar
+ 4
new code about the shift operators just posted on my profile take a look to learn about the shift operators
18th Mar 2017, 1:13 AM
chris
chris - avatar
+ 3
@jafca is correct, in c# it shifts the binary number to the right or to the left. it's different from what @chris has explained which is about c++ language.
12th Mar 2017, 7:39 AM
gjh4cker
gjh4cker - avatar
0
<< and >> are also called casceding of operators which is explained by chris..
11th Mar 2017, 6:02 PM
Mustafa Rokadiya
Mustafa Rokadiya - avatar
- 1
Hello
14th Mar 2017, 2:51 PM
Denis