Create octal constant by starting with 0, followed by a sequence of digits in the range 0 through 7 in CSharp

Description

The following code shows how to create octal constant by starting with 0, followed by a sequence of digits in the range 0 through 7.

Example


using System;//ww w  .  j  a  v  a  2  s .c o m

public class MainClass{
    public static void Main() {
        //The digits 8 and 9 are errors in specifying an octal constant.
        int i = 0377;   // Octal constant
        int j = 0397;   // Error: 9 is not an octal digit
        Console.WriteLine(i);
        Console.WriteLine(j);
    }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    Data Types »




C# Data Types
Bool
Byte
Char
Decimal
Double
Float
Integer
Long
Short
String
C# Array
Array Example
Byte Array
C# Standard Data Type Format
BigInteger
Complex
Currency
DateTime
DateTimeOffset
DateTime Format Parse Convert
TimeSpan
TimeZone
Enum
Null
tuple
var