2017-3-1 数组
(一) 数组的定义:
1数组里面的内容必须是同一类型,2数组必须有长度限制
什么事数组:一组变量,作用操作大量的数据
(二)一维数组
数据类型[] 变量名 = new 数据类型[长度] ; 重点了解
数据类型[] 变量名 = new 数据类型[]{aa,bb,cc,dd}; 重点了解
数据类型[] 变量名 = new 数据类型[4]{aa,bb,cc,dd}; 了解
一维数组的赋值:变量名[下标] = 值; 取值: 变量 = 变量名[下标]
(三)二维数组
1.定义:string[,] aa = new string[2,3]{{"aa","bb","cc"}{"dd","ee","ff"}};
含义:有2个一维数组,每个一维数组里面包含3个变量
列:如果取出dd,就是aa[1,0] 第二个数组里,第一个变量
(四)三维数组
1.定义 string[,,] aaa = new string[2,3,4]
含义:有2个二维数组,每个二维数组里面有3个一维数组,每个一维数组里面有4个变量
{
{{"a","b","c","d"}{"a","b","c","d"}{"a","b","c","d"}}
{{"a","b","c","d"}{"a","b","c","d"}{"a","b","c","d"}}
}