+ 2

What does it means int x<< 2 in C#

x is a Integer values, I don't understand '<<' that kind of operator in C#

25th Mar 2017, 4:11 AM
Abdullayev Faxriddin Raxmatulla o'g'li
4 Respuestas
+ 3
It's the bit shift operator. What this is doing is shifting x two bits to the left. Consider the binary representation of two: 0010. If we shift it two bits to the left (2 << 2), we wind up with 1000 (zeroes are added to the end). Convert that back into decimal, and you have 8.
25th Mar 2017, 4:14 AM
Squidy
Squidy - avatar
+ 2
I agree with you. '<<' is left binary shift operator. and after left shifting 2-time but what is the value of 'x' before left shift. and also 'int' is on the expression
26th Mar 2017, 8:34 AM
Bheemsen Singh
Bheemsen Singh - avatar
0
fg
26th Apr 2017, 10:09 AM
mei
mei - avatar
0
what is the value of x?
26th Apr 2017, 10:10 AM
mei
mei - avatar