One-dimensional array definition:
data type [] Array name = new data type [array length];
data type [] Array name = new data type [array length]{1,2,3 ...};
Two-dimensional array definitions:
data type [,] array name = new data type [number of rows, number of columns];
int[,] a = new int[3,4];
Assignment: a[row subscript, column subscript] = value subscript is starting from 0
Value: a[row subscript, column subscript]
Jagged data, an array of array definitions:
The first step: Define a large group
data type [] A = new data type [number of rows] []; Number of columns not written
Step two: Define the decimal group
Data type [] a1 = new data type [number of columns];
Data type [] a2 = new data type [number of columns];
......
Part III: Placing decimal groups in large arrays
A[0] = A1;
A[1] = A2;
......
Two-dimensional arrays and jagged arrays:
int[,] a = new int [3][4]; Wrong
Int[][] A = new int[3,4];//error
Int[][] A = new int[3][4];//error
int[,] C = new int[3,4];//pair
C.length = = ;
Int[][] A = new int[3][];
int[] A1 = new int[] {3, 4, 5, 6, 7};
int[] A2 = new int[] {1, 2, 3};
int[] a3 = new int[] {7, 8, 9, 10};
A[0] = A1;
A[1] = A2;
A[2] = A3;
A.length = = 3;
Two-dimensional arrays