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

image_pdfimage_print
   
 


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

   
     


This entry was posted in Data Types. Bookmark the permalink.