Mega Code Archive

 
Categories / C# Book / 01 Language Basics
 

0019 Integer type literal

Literals are hard coded value to a certain type. For example, 0 is a literal for int type. The following code uses int literal to initialize an int type variable. using System; class Program { static void Main(string[] args) { int i = 5; Console.WriteLine(i); } } The output: 5