Assign values to char array elements : char array « Data Type « C# / CSharp Tutorial






using System;

class MainClass
{
  static void Main(string[] args)
  {
    char[] MyChar = new char[6];

    MyChar[0] = 'H';
    MyChar[1] = 'e';
    MyChar[2] = 'l';
    MyChar[3] = 'l';
    MyChar[4] = 'o';
    MyChar[5] = '\0';


        Console.WriteLine(MyChar);
  }
}








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