Declaring a multidimensional array
? Create a multidimensional array
int[,] Intmatrix;
float[,] Floatmatrix;
String[,,] strcube;
Xuepub.com
? Use the New keyword
? You must specify the size of each dimension
int[,] Intmatrix = new int[3, 4];
float[,] Floatmatrix = new float[8, 2];
String[,,] stringcube = new string[5, 5, 5];
Jagged array jagged arrays
? Jagged arrays are a bit like multidimensional arrays
? But each dimension has a different size
? Jagged arrays are arrays of arrays
? Each array has a different length
How to create a jagged array
Int[][] jagged = new int[3][];
Jagged[0] = new INT[3];
JAGGED[1] = new INT[2];
JAGGED[2] = new INT[5];
Generates a function Gen01 of 01, through which recursion is realized:
Static void Gen01 (intint[] vector) { if (index = =-1) Print (vector); Else for (int i=0; i<=1; i++) { = i; Gen01 (Index-1, vector); } }
Gen01
C # Programming Courseware-C # Basics