I. Two-D arrays
Definition of a two-dimensional array: Data type array name [constant expression 1][constant expression 2] = {value 1, value 2,.... Value n};
For example:
int Array[3][3] = {{1, 2, 3},
{2, 1, 3},
{3, 1, 2}};
A two-dimensional array array[3][3] is the equivalent of three one-dimensional arrays containing three elements.
Number of array elements how to: two-dimension index multiplication
Accessing elements in a two-dimensional array: double subscript
Multidimensional Arrays:
Three-dimensional array: array name [constant expression 1][constant expression 2][constant expression 3] = {value 1, value 2,.... Value n};
Multidimensional Arrays: Several dimensions, there are several brackets, the access of the element has a few layers subscript, the traversal requires a few layers for the loop
Array of strings:
Char array[constant expression 1][constant expression 2] = {"", "", ...};
Note: The string array, the second dimension, must be 1 larger than the longest string;
To access a single character:
ARRAY[I][J]
Output string:
printf ("%s\n", arra[3]);//access only to the row index,
Output All strings:
for (int i = 0; i < 4; i++) {
printf ("%s", Array[i]);
}
C language V: two-dimensional arrays, multidimensional arrays