using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace shuzu2
{
class Program
{
static void Main(string[] args)
{
int i=3,j=4;
//模仿老师的代码
int[][] b = new int[i][];
b[0] = new int[4];
b[1] = new int[3];
b[2] = new int[2];
Console.WriteLine("b.length:"+b.Length+"\nb[0].length : "+b[0].Length+"\nb[1] : "+b[1].Length);
//自己写个验证一下
int[][] a = new int[2][];
a[0] = new int[4]{4,5,7,6};
a[1] = new int[3]{5,6,2};
Console.WriteLine("\na.length : "+a.Length+"\na[0] : "+a[0].Length);
//int[][] d = new int[][3];错误的
//定义一个规则数组和不规则数组对比一下,就懂了
int[,] c = new int[i, j];
Console.WriteLine("\nc[i,j]length : " + c.Length);
//对于规则数组,length=i*j 不规则数组: length=i
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace shuzu2
{
class Program
{
static void Main(string[] args)
{
int i=3,j=4;
//模仿老师的代码
int[][] b = new int[i][];
b[0] = new int[4];
b[1] = new int[3];
b[2] = new int[2];
Console.WriteLine("b.length:"+b.Length+"\nb[0].length : "+b[0].Length+"\nb[1] : "+b[1].Length);
//自己写个验证一下
int[][] a = new int[2][];
a[0] = new int[4]{4,5,7,6};
a[1] = new int[3]{5,6,2};
Console.WriteLine("\na.length : "+a.Length+"\na[0] : "+a[0].Length);
//int[][] d = new int[][3];错误的
//定义一个规则数组和不规则数组对比一下,就懂了
int[,] c = new int[i, j];
Console.WriteLine("\nc[i,j]length : " + c.Length);
//对于规则数组,length=i*j 不规则数组: length=i
}
}
}