using System;
class Program {
static void show(int [][]b)
{
for(int i=0;i<b.GetLength(0);i++)
{
for(int j=0;j<b[i].GetLength(0);j++)
{
Console.Write(b[i][j]+ "\t");
}
Console.WriteLine();
}
}
static void show1(int [,]b)
{
for(int i=0;i<b.GetLength(0);i++)
{
for(int j=0;j<b.GetLength(1);j++)
{
Console.Write(b[i,j]+ "\t");
}
Console.WriteLine();
}
}
static void Main(string[] args) {
//声明二维数组的第一种方式
int [][]a = new int[2][];
a[0] = new int[2]{0,1};
a[1] = new int[3]{0,1,2};
for(int i=0;i<a.GetLength(0);i++)
{
for(int j=0;j<a[i].GetLength(0);j++)
{
//Console.Write(a[i][j]+ "\t");
}
//Console.WriteLine();
}
show(a);
//声明数组的第二种方式
int [,]b = new int[2,3]{{0,1,2},{0,1,2}};
for(int i=0;i<b.GetLength(0);i++)
{
for(int j=0;j<b.GetLength(1);j++)
{
//Console.Write(b[i,j]+ "\t");
}
//Console.WriteLine();
}
show1(b);
}
}