C#数组的使用,数组及数组的下标、个数

namespace gowater 
{
    class Program {
        static void Main()
        {
            int[] array = new int[5] {1,2,3,4,5};
            Console.WriteLine(array[1]);
            Console.WriteLine(array[2]);
        }
    }
}

  多维数组

namespace gowater 
{
    class Program {
        static void Main()
        {
            int[,] arr = {
            {1,2,3,4},
            {9,2,3,6 },
            {1,9,3,4 },
            {1,2,9,4 },
            { 1,2,8,4},
            {1,2,3,9 },
            };

            Console.WriteLine(arr[0,0]);
        }
    }
}

  

posted @ 2026-08-05 15:58  华腾智算  阅读(3)  评论(0)    收藏  举报
https://damo.alibaba.com/ https://tianchi.aliyun.com/course?spm=5176.21206777.J_3941670930.5.87dc17c9BZNvLL