Think of a shoe rack at home. Each shelf holds a shoe, and all of them are stored in one organized structure.
In software, we also want to keep multiple values inside one structure. That is called an array.
string[] isimler = { "Emre", "Ayşe", "Mehmet" };
Defining a separate variable for every student name would be messy and tiring. Keeping them in one structure makes much more sense.
An array makes it easier to store data in bulk and perform operations on it.
Every item in an array has an order number. This is called an index.
The important detail is this: indexing starts from 0, not from 1.
string[] isimler = { "Emre", "Ayşe", "Mehmet" };
Console.WriteLine(isimler[0]);
Console.WriteLine(isimler[1]);
To go through all items in an array one by one, you use a loop. That way, you do not have to write each element manually.
string[] isimler = { "Emre", "Ayşe", "Mehmet" };
for (int i = 0; i < isimler.Length; i++)
{
Console.WriteLine(isimler[i]);
}
Arrays are simple and powerful, but they work with a fixed size. That is why it is important to know when to use an array and when to use another structure.