2010/02/17

C# week4_2


16/02/201
Array: use more than one value

int[] i = new int[3];
int[0] = 1;
int[1] = 5;
int[2] = 7;
      index or secretive value (If you create array "n", it means index becomes "n-1".)

string[] k = new string[2];
k[0] = "2"; ….

int[] i = {1,2,3,4};

Multidimensional Array: more than one dimensional array
* It doesn't mean graph such as 3D (x, y, z), so C# allow to use whatever number of dimensional is. (But it will be required more memory.)
int[,] m = new int[2,2,2];
jagged array: it become to use memory efficiently when you use multidimensional array.

int[,] l = new int[4][];
l[0] = new int[1];
l[1] = new int[2];
l[2] = new int[1];
l[3] = new int[1];

l[0][0] = 1;
l[0][1] = 5; error

0 件のコメント:

コメントを投稿

UA-9417263-1