Shift Operators: shift left and right : shift operator « Operator « C# / CSharp Tutorial






using System;

class MainClass
{
   static void Main()
   {
      int a, b, x = 14;
      a = x << 3;      // Shift left
      b = x >> 3;      // Shift right
      Console.WriteLine("{0} << 3 = {1}", x, a);
      Console.WriteLine("{0} >> 3 = {1}", x, b);
   }
}
14 << 3 = 112
14 >> 3 = 1








3.10.shift operator
3.10.1.The Shift Operators
3.10.2.Shift Operators in action
3.10.3.Shift Operators: shift left and right