Initialize int arrays : int array « Data Type « C# / CSharp Tutorial






using System;

class MainClass
{
  public static void Main()
  {
    
    int[] intArray = new int[5] {10, 20, 30, 40, 50};
    for (int counter = 0; counter < intArray.Length; counter++)
    {
      Console.WriteLine("intArray[" + counter + "] = " +
        intArray[counter]);
    }

  }
}
intArray[0] = 10
intArray[1] = 20
intArray[2] = 30
intArray[3] = 40
intArray[4] = 50








2.5.int array
2.5.1.int arrays
2.5.2.Initialize int arrays
2.5.3.Use a foreach loop through an int array
2.5.4.int array with for loop
2.5.5.Get the Max Value in an array