Initialize int arrays : Int array : Data Type C# Examples


C# Examples » Data Type » Int array »

 

Initialize int arrays









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

    }
}
    
   
  
   



Output

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


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Data Type
» Int array