char arrays : Char array : Data Type C# Examples


C# Examples » Data Type » Char array »

 

char arrays









    
using  System;

class  MainClass
{

    public  static  void  Main()
    {
        
        char[]  charArray  =  new  char[5];
        Console.WriteLine("charArray[0]  =  "  +  charArray[0]);
        charArray[0]  =  'h';
        charArray[1]  =  'e';
        charArray[2]  =  'l';
        charArray[3]  =  'l';
        charArray[4]  =  'o';
        for  (int  counter  =  0;  counter  <  charArray.Length;  counter++)
        {
            Console.WriteLine("charArray["  +  counter  +  "]  =  "  +
                charArray[counter]);
        }
    }

}
    
   
  
   



Output

charArray[0] =
charArray[0] = h
charArray[1] = e
charArray[2] = l
charArray[3] = l
charArray[4] = o


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Data Type
» Char array