Array

umida5 - Oct 14 - - Dev Community

Array - bir xil turdagi elementlar ketma-ketligini saqlash uchun ishlatiladi.
Misol

int[] sonlar = new int[5];
sonlar[0] = 10;
sonlar[1] = 20;
sonlar[2] = 30;
sonlar[3] = 40;
sonlar[4] = 50;

foreach (int son in sonlar)
{
    Console.WriteLine(son);
}
Enter fullscreen mode Exit fullscreen mode
int[] numbers = {1, 2, 3, 4, 5};
Console.WriteLine(numbers[2];
Enter fullscreen mode Exit fullscreen mode

Bu kodning natijasi: 3 chunki index 0 dan boshlanadi va shunda 0 chi indexda 1, 1 chi indexda 2, 2chi indexda 3

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .