To specify an octal constant, begin the specification with 0, followed by a sequence of digits in the range 0 through 7. : octal « Data Types « C# / C Sharp






To specify an octal constant, begin the specification with 0, followed by a sequence of digits in the range 0 through 7.

 


using System;

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);
    }
}

   
  








Related examples in the same category

1.Leading zero specifies octal constant, not decimal
2.Not a decimal number; erroneous octal constant