Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / C#

>>>: practical reference

>>>: practical reference: >>> shifts right logically and always fills with zeros.

Version: C# operator reference; verified against C# 14

Syntax

left >>> right

shifts right logically and always fills with zeros.

Use it to interpret signed bits without sign propagation.

For sbyte, byte, short, and ushort, integral promotion changes the left operand to int, so the result is int; otherwise the result type follows the promoted left operand.

The shift count is masked, and the operator requires a C# version that supports >>>.

The complete program actually uses >>>; its exact expected stdout is 2147483644.

Examples

using System;
using System.Linq;
using System.Threading.Tasks;

Console.WriteLine(-8 >>> 1);

Result

2147483644

The complete program actually uses `>>>`; its exact expected stdout is `2147483644`.

Sources