Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - The two-dimensional array problem in C language outputs the maximum and minimum values of a three-row and four-column two-dimensional plastic array (where the array is dynamically initialized).
The two-dimensional array problem in C language outputs the maximum and minimum values of a three-row and four-column two-dimensional plastic array (where the array is dynamically initialized).
functionshuzu(arr){

var sum = 0;

for(vari = 0; I<3; i++)

{

for(varj = 0; j & lt4; j++)

{

sum+=arr,,]

Shu Zu (1);

Maximum value (a);

Minimum (a);

Extended data

Definition of two-dimensional array

Array Element Type Array Name [Array Line Number] [Array Column Number], and the result of array line number * array column number indicates the data elements in the array. The number in the first square bracket [] indicates the number of rows in the array, and the number in the second square bracket [] indicates the number of columns in the array.

Such as inta [2] [2]; 2 in the first bracket means defining the one-dimensional array a[0]a[ 1], and also means the first dimension; The 2 in the second bracket means that each array has two elements, namely a[0][0], a[0][ 1], a[ 1][0], a[ 1], which also means the second dimension. That is, if you want to access the first element representing the second dimension, you can use a[ 1][ 1].

Where [] [] is the symbol of a two-dimensional array, we usually access each element in the array through the reference in the following table (we can also access it through a pointer, which is essentially the same as how to access the elements in the array through a pointer later).