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






using System;

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








2.20.char array
2.20.1.char arrays
2.20.2.Initialize char arrays
2.20.3.Output char array
2.20.4.Assign values to char array elements