Monday, July 27, 2009

What is >> in the C language? Is there an equivalent in C#?

In context, what is the following code doing? I need to translate to C#.





x = (char) (i%26gt;%26gt;8) ;

What is %26gt;%26gt; in the C language? Is there an equivalent in C#?
In C, %26gt;%26gt; is the right bitshift operator. i %26gt;%26gt; 8 shifts all bits in the variable i to the right 8 spaces.





I am not a .NET programmer, but I believe it is the same in C#.
Reply:wow Report It

Reply:%26gt;%26gt; is "shift right".


So if you have 0x500 %26gt;%26gt; 8 will be 5.
Reply:I always thought was greater than.

customer survey

No comments:

Post a Comment