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






using System;

class MainClass
{

  public static void Main()
  {

    
    int[] intArray = new int[10];
    int arrayLength = intArray.Length;

    Console.WriteLine("arrayLength = " + arrayLength);

    for (int counter = 0; counter < arrayLength; counter++)
    {
      intArray[counter] = counter;
      Console.WriteLine("intArray[" + counter + "] = " + intArray[counter]);
    }

  }

}
arrayLength = 10
intArray[0] = 0
intArray[1] = 1
intArray[2] = 2
intArray[3] = 3
intArray[4] = 4
intArray[5] = 5
intArray[6] = 6
intArray[7] = 7
intArray[8] = 8
intArray[9] = 9








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