int[] numbers = new int[5]; //一维数组
string[,] names = new string[4, 5]; //多维数组
Console.WriteLine(names.Length);
int[][] scores = new int[4][]; //数组的数组(交错数组)
for (int i = 0; i < scores.Length; i++)
{
scores[i] = new int[i + 3]; //创建交错数组
}
for (int i = 0; i < scores.Length; i++)
{
Console.WriteLine("第{0}行是{1}", i, scores[i].Length);
}
Console.WriteLine("数字的行数是{0}", scores.Length);
数组中的三种数组
最新推荐文章于 2024-02-23 20:43:17 发布