An array represents a fixed number of variables of a particular type. You can create an array with square brackets after the element type
char[] letters = new char[5];
You can also assign data to an array
letters[0] = 'c';
letters[1] = 's';
letters[2] = 'h';
letters[3] = 'a';
letters[4] = 'r';
letters[5] = 'p';
To declare and initialize an array you can write as shown below
char[] letters = new char[] {'c','s','h','a','r','p'};
or simply
char[] letters = {'c','s','h','a','r','p'};
To get a value of an array you can access a particular element by position
Console.WriteLine (letters[0]);//c
or can use a for loop statement to iterate through each element in the array
for (int i = 0; i < letters.Length; i++) {
Console.Write (letters[i]);//csharp
}
or you can also use the foreach loop to access elements of an array
foreach (var c in letters) {
Console.Write (c);//csharp
}