The below program will help you to initialize the char array. While defining the array you can pass the set of value to directly initialize it. The for loop is used here to print the char array values.
using System;
namespace ConsoleHub
{
class Programs
{
static void Main(string[] args)
{
char[] CharArray = { 'A', 'B', 'C', 'D', 'E' };
for (int i = 0; i < CharArray.Length; i++)
Console.Write(" {0}", CharArray[i]);
Console.ReadLine();
}
}
}
No comments:
Post a Comment