From

xiaoxiao2021-03-06  172

Word Source VC World - C language classroom

Self-archiving, also dedicated to the same Delphi programmer as me

Array

Array In programming, in order to handle convenience, a number of variables having the same type are organized in order. The set of these sequentially arranged similar data elements is called an array. In the C language, the array belongs to the configuration data type. An array can be broken down into multiple array elements, which can be a basic data type or a constructive type.

The general form is: Type Description Architecture Name [constant expression], ...; where the type specifese is any basic data type or constructive data type. An array name is a user-defined array identifier. The constant expression in square brackets represents the number of data elements, also known as the length of the array. For example: INT A [10]; Description Integer array A, 10 elements. Float B [10], C [20]; Description Real array B, 10 elements, real array C, and 20 elements. CHAR CH [20]; Description Characters CH, with 20 elements.

For array types, you should pay attention to the following points: 1. The type of array is actually an index type element. For the same array, the data types of all elements are the same. 2. The writing rules of the array name should meet the writing of the identifier. 3. The array name cannot be the same as the other variable name, for example: void main () {Int a; float a [10]; ...} is wrong. 4. The constant expression in square brackets represents the number of array elements, such as A [5] indicates that the array A has 5 elements. However, its subscript starts from 0. Therefore, 5 elements are A [0], A [1], A [2], A [3], A [4]. 5. The number of elements cannot be represented in square brackets, but may be symbol constant or constant expression. For example: #define fd 5void main () {INT A [3 2], B [7 fd]; ...} is legal. However, the following description is incorrect. Void main () {int n = 5; int A [n]; ...} 6. Allows multiple arguments and multiple variables to be described in the same type description. For example: INT A, B, C, D, K1 [10], K2 [20];

Representation of array elements

The array element is a basic unit that makes up an array. The array element is also a variable, which identifies the number of group names and one subscript. The subscript represents the sequence number in the array. The general form of array elements is: array name [subscript] where the subscript can only be integer or integer. If it is a decimal, C compile will be automatically het. For example, A [5], A [i J], A [i ] is all legitimate array elements. Array elements are often also referred to as subscript variables. An array must first be defined to use the subscript variable. Only the subscript variable can be used one by one in the C language, and the entire array cannot be referenced at a time. For example, an array of outputs having 10 elements must use a cyclic statement to output each subtrane variable: for (i = 0; i <10; i ) printf ("% d", a [i]); instead of using a statement Output the entire array, the following is wrong: Printf ("% d", a); void main () {INT I, A [10]; for (i = 0; i <10;) a [i ] = 2 * i 1; for (i = 9; I> = 0; i -) Printf ("% d", a [i]); printf ("/ n% D% D / N", A [5.2 ], A [5.8]);} for (i = 0; i <10;) a [i ] = 2 * i 1; for (i = 9; I> = 0; i -) printf ("% D ", A [I]); Printf (" / N% D% D / N ", A [5.2], A [5.8]); this example is sent to the A array of each element in this example. Then use the second cycle statement from the large to small output. In the first FOR statement, the expression 3 is omitted. Expression I is used in the subscript variable to modify the loop variable. Of course, the second For statement can also be made, the C language allows the subscript to be represented by an expression. The last printf statement in the program outputs the value of A [5], which can be seen when the header is not integer. The method of assigning the array assignment to array assignment is assigned to the array element by assigning statements, and the method of initializing assignment and dynamic assignment can be used. An array initialization assignment array initialization assignment refers to the initial value to array elements when an array description is explained. An array initialization is done during the compilation phase. This will reduce the runtime and improve efficiency. The general form of initialization assignment is: static type Description number group name [constant expression] = {value, value ... value}; where STATIC represents the static storage type, C language regulations only static storage arrays and external storage arrays Initialization assignment (the concept of static storage, external storage is described in Chapter 5). The data values ​​in {} are initial values ​​of each element, and the comma intervals are used between each value. For example: Static int A [10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; equivalent to a [0] = 0; a [1] = 1 ... a [9] = 9;

The C language has the following initial assignments of the array: 1. You can only assign a first value to some elements. When the number of values ​​in {} is less than the number of elements, only the front partial element is assigned. For example: Static int A [10] = {0, 1, 2, 3, 4}; denoted only 5 elements of A [0] to A [4], and the last 5 elements are 0 value. 2. You can only assign a value one by one, and you cannot assign a value to the array. For example, give 10 elements all assigned a value, can only be written as: Static Int A [10] = {1, 1, 1, 1, 1, 1, 1, 1, 1}; can not be written as: static INT A [10] = 1; 3. All elements are 0 values ​​if the number of initializable numbers is not assigned. 4. Assign a value to all elements, in the array description, the number of array elements may not be given. For example: Static int A [5] = {1, 2, 3, 4, 5}; can be written as: static int a [] = {1, 2, 3, 4, 5}; dynamic assignment can be executed In the case, the array is dynamically assigned. At this time, the available cyclic statements are assigned to the array element one by one. Void main () {INT I, MAX, A [10]; Printf ("INPUT 10 NUMBERS: / N"); for (i = 0; i <10; i ) scanf ("% d", & a [i] ); max = a [0]; for (i = 1; i <10; i ) IF (a [i]> max) max = a [i]; printf ("Maxmum =% D / N", max) } for (i = 0; i <10; i ) scanf ("% d", & a [i]); max = a [0]; for (i = 1; i <10; i ) IF (A [ I]> max) max = a [i]; printf ("maxmum =% D / n", max); the first for statement in this program inputs 10 numbers A one by one. Then send A [0] into the max. In the second For statement, from A [1] to A [9] compared to the contents of the max, if the value is larger than the value of the max, the subscript variable is sent to the max, so Max is always The compared subscript variable is the biggest. The comparison ends, outputs the value of the MAX. Void main () {INT I, J, P, Q, S, A [10]; Printf ("/ n INPUT 10 NUMBERS: / N"); for (i = 0; i <10; i ) scanf (" % D ", & A [I]); for (i = 0; i <10; i ) {p = i; q = a [i]; for (j = i 1; j <10; j ) IF ( QIF (i! = P)

{s = a [i];

a [i] = a [p];

a [p] = s;}

Printf ("% d", a [i]);

}

}

For (i = 0; i <10; i )

Scanf ("% d", & a [i]);

For (i = 0; i <10; i ) {

P = I; Q = a [i];

For (j = i 1; j <10; j )

IF (q

IF (i! = P)

{s = a [i];

a [i] = a [p];

a [p] = s;}

Printf ("% d", a [i]);

}

In this program, two parallel FOR cycle statements are used in this case, and a loop statement is nested in the second for statement. The first for statement is used to enter a first value of 10 elements. The second for statement is used to sort. The sort of this program is carried out by a method of comparing one by one. When the I cycle is cycled, the subscript I of the first element is assigned to P, and the subscript variable value A [I] is paired in Q. Then enter a small cycle, from a [i 1] to the last element, compared with the A [I], there is a larger than the A [i], and it is subscripted to send P, and the element value is sent q. After the end of the cycle, p is the subscript of the maximum element, Q is the element value. If I ≠ P, the P, the Q value is not igned before entering the small cycle, then exchange A [I] and A [P] value. At this time, A [i] is the elements that have been sorted. Transfer to the next loop after outputting this value. Sort each element after I 1. Two-dimensional array

The array previously introduced has only one subscript called a one-dimensional array, and its array element is also called a single-down variable. There are many quantities in actual problems that are two-dimensional or multi-dimensional, so the C language allows for constructing multi-dimensional arrays. The multi-dimensional array element has multiple subscripts to identify it in the array, and it is also known as the multi-slogan variable. This section only describes the two-dimensional array, and the multi-dimensional array can be obtained by two-dimensional array. Two-dimensional array type Description 2D array type description general form is: Type Description Name [constant expression 1] [constant expression 2] ...; in which constant expression 1 represents the length, constant expression of the first dimension 2 Represents the length of the second dimension. For example: INT A [3] [4]; illustrates an array of three rows of four columns, an array name is A, and its subscript variable is integer. The number of subscript variables of this array has a total of 3 × 4, namely: a [0] [0], A [0] [1], A [0] [2], A [0] [3] a [1] [ 0], A [1] [1], A [1] [2], A [1] [3] A [2] [0], A [2] [1], A [2] [2], A [2] [3] The two-dimensional array is conceptually two-dimensional, ie it is said that the subscript changes in both directions, the position of the subscript variable in the array is in one plane, not like one The dimension is just a vector. However, the actual hardware memory is continuously addressing, that is, the memory cell is arranged in one dimensional linear. How to store a two-dimensional array in a one-dimensional memory, there can be two ways: one is arranged in line, that is, put it in the second line after a line. The other is ranked by column, that is, after putting a column, then put it in the second column. In C language, two-dimensional array is arranged in line. In Figure 4.1, press in the line, first store A [0] row, then store A [1] line, and finally store A [2] line. There are four elements in each row to be stored sequentially. Since the array A illustrates the INT type, this type accounts for two bytes of memory space, so each element has two bytes (each of the map is one byte).

Representation of two-dimensional array elements

Elements of the two-dimensional array are also referred to as two-lowering variables, which are represented by: array name [subscript] [subscript] where the following indicator should be integer or integer. For example: A [3] [4] shows an element of three rows of A array. The subscript variable and array description are some similar in the form, but both have a completely different meaning. The square brackets described in the array are given a certain length of the scale, that is, the maximum value of the subscript; the subscript in the array element is the position identifier of the element in the array. The former can only constant, the latter can be constant, variables, or expressions. A learning team has 5 people, and everyone has three courses. Ask the average score of the whole group and the average scores of each department. Course Score Name Math C DBASE 80 75 92 King 61 65 71 Lee 59 63 70 Zhao 85 87 90 Week 76 77 85 You can set a two-dimensional array a [5] [3] to store five people's three courses. Then set a one-dimensional array v [3] to store the average scores of each of the science, and the variable L is the average proportion of the entire group. The programming is as follows: void main () {INT I, J, S = 0, L, V [3], A [5] [3]; Printf ("Input Score / N"); for (i = 0; i < 3; i ) {for (j = 0; j <5; j ) {scanf ("% d", & a [j] [i]); s = s a [j] [i];} v [i ] = S / 5; s = 0;} L = (V [0] V [1] V [2]) / 3; Printf ("Math:% D / NC Languag:% D / NDBASE:% D / N ", V [0], V [1], V [2]); Printf (" TOTAL:% D / N ", L);} for (i = 0; j <3; i ) for (J = 0; J <5; J ) {scanf ("% d", & a [j] [i]); s = s a [j] [i];} v [i] = s / 5; s = 0;} l = (v [0] V [1] V [2]) / 3; the program first uses a dual cycle. In the internal cycle, read the results of each student of a certain course, add these achievements, and then remove the accumulated grade after passing the accumulated score, which is the door course. Average score. The external cycle is circulated three times, and the average scores of the three classes are obtained, respectively, and store them in the V array. After exiting the external cycle, add V [0], V [1], v [2] to 3 to obtain average score of each department. Finally, various grades are output according to the question.

The initialization 2D array initialization of the two-dimensional array is also assigned to each of the subsequent variables at the beginning of the type. Two-dimensional arrays can be assigned by line segmentation, or they can be assigned in a row. For example, the array a [5] [3]: 1. Follow the segmentation assignment to static int A [5] [3] = {{80, 75, 92}, {61, 65, 71}, {59 , 63, 70}, {76, 87, 90},}; 2. Continuous assignment by line to static int A [5] [3] = {80, 75, 92, 61 65, 71, 59, 63, 70, 85, 87, 90, 76, 77, 85}; the result of these two gear values ​​is identical. Void main () {INT I, J, S = 0, L, V [3]; Static Int A [5] [3] = {{80, 75, 92}, {61, 65, 71}, {59 63, 70}, {85, 87, 90}, {76, 77, 85}}; for (i = 0; i <3; i ) {for (j = 0; j <5; j ) s = S A [J] [I]; V [I] = S / 5; S = 0;} L = (V [0] V [1] V [2]) / 3; Printf ("Math: % D / NC LanguAg:% D / NDBase:% D / N ", V [0], V [1], V [2]); Printf (" Total:% D / N ", L);} For two The initialization assignment of the dimension array is also described below: 1. You can only assign a primary value on the partial element, and an element that is not assigned automatically 0 value. For example, Static Int A [3] [3] = {{1}, {2}, {3}}; is assigned to each line of the first column element to each line, not assigning element 0 value. The value of each element is: 1 0 02 0 03 0 0 Static Int A [3] [3] = {{0, 1}, {0, 0, 2}, {3}}; the value after the value It is 0 1 00 0 23 0 0 2. If the total element is assigned, the length of the first dimension may not be given. For example: Static int A [3] [3] = {1, 2, 3, 4, 5, 6, 7, 8, 9}; can be written as: Static Int A [] [3] = {1, 2, 3, 4, 5, 6, 7, 8, 9}; arrays are data for constructive types. The two-dimensional array can be constructed as nested by a one-dimensional array. Each element of a one-dimensional array is also an array, which constitutes a two-dimensional array. Of course, the premise is that each element type must be the same. According to such an analysis, a two-dimensional array can also be broken down into a plurality of one-dimensional arrays. The C language allows this decomposition to have two-dimensional array a [3] [4], which can be broken down into three one-dimensional arrays, and the number of groups is A [0], A [1], A [2]. For these three one-dimensional arrays, it can be used without another instructions. These three one-dimensional arrays have 4 elements, such as: one-dimensional array a [0] element is A [0] [0], A [0] [1], A [0] [2], A [ 0] [3]. It must be emphasized that A [0], A [1], A [2] cannot be used as a subscript variable, which is an array name, not a simple subscript variable. Characters

The array used to store the word symbol is called a character array. The form of the character array type description is the same as the value array previously described. For example: CHAR C [10]; due to character type and integer, it can be defined as INT C [10] but then each array element accounts for 2 bytes of memory units. The character array can also be two-dimensional or multi-dimensional arrays, such as CHAR C [5] [10]; it is a two-dimensional character array. The character array also allows initialization assignment when the type description. For example: static char C [10] = {`C`,` `,` p`, `r`, o`, g`, r`,` a`, `m`}; the value of each element is assigned : Array C C [0] C [1] C [2] C [3] C [4] C [5] C [6] C [7] C [8] C [9] where C [9] is not assigned 0 automatically assign 0 value by the system. The length will be omitted when the entire element is assigned. For example: static char c [] = {`C`,` `,` p`, `r`,` a`, `` `;` `` ` The length is automatically set to 9. Main () {Int i, j; char a [] [5] = {{'b', 'a', 's', 'i', 'c',}, {'d', 'b', 'A', 's', 'e'}}; for (i = 0; i <= 1; i ) {for (j = 0; j <= 4; j ) Printf ("% C", A [ I] [j]); Printf ("/ n");}} The two-dimensional character array of this example is assigned to the initial value due to the initialization, so the length of the one-dimensional subscript may not be described. String does not have a dedicated string variable in the C language, usually with a character array to store a string. When the string constant is introduced in Section 2.1.4, the string has always been ended as a string of '/ 0'. Therefore, when a string is stored in an array, the endor '/ 0' is also stored in an array, and the flag is ended as the string. With the '/ 0' flag, you don't have to use the length of the character array to determine the length of the string. The C language allows the array to initialize the value to the array in the manner. For example: static char C [] = {'c', '', 'p', 'r', 'o', 'g', 'r', 'a', 'm'}; writable: static Char c [] = {"c program"}; or remove {} is written as: sratic char c [] = "c program"; assigning a value with a string to assign a value to one byte by one by one by one by one by one byte, used to store The string end flag '/ 0'. The actual storage of the array C above in memory is: c program / 0` / 0 'is automatically added by the C compilation system. Due to the use of the `/ 0 'flag, there is no need to specify the length of the array when serving the initial value with the character, and is processed by the system. After using a string method, the input and output of the character array will become simple and convenient. In addition to the above-mentioned characters, the strings in the character array can be input to a character array with the Printf function and the Scanf function, without having to enter the output per character by one by one by one by one.

Void main () {static char C [] = "Basic / NDBase"; Printf ("% s / n", c);} Printf ("% s / n", c); Note in this sample's printf function The format string used is "% s", indicating that the output is a string. The group name is given in the output table column. Can't be written as: Printf ("% s", c []); void main () {char ST [15]; Printf ("Input String: / N"); scanf ("% s", st); printf "% s / n", st);} Char ST [15]; this example is due to the definition array length 15, so the input string length must be less than 15 to leave a byte for stamping end flags `/ 0`. It should be noted that an array length must be explained if an array of characters is not initialized. It should also be noted that when entering a string with the SCANF function, the string cannot be contained in the string, otherwise the space will be used as the end of the string. For example, operational examples 4.8, when in the input string contains spaces, the operation is: input string: this is a book this From the output result, you can see the characters after the space is not output. To avoid this, you can set a few character array segments to store a string containing spaces. The program can be rewritten as follows: Lessonvoid main () {char ST1 [6], ST2 [6], ST3 [6], ST4 [6]; Printf ("INPUT STRING: / N"); scanf ("% s% s% S% S ", ST1, ST2, ST3, ST4); Printf ("% S% S% S% S / N ", ST1, ST2, ST3, ST4);} This program has four arrays, input The space segment of a line of characters is loaded into four arrays. The string of these four arrays is then output separately. In the previous introduction, the input items of Scanf must appear in address, such as & A, & B, etc. However, in Example 4.8, it is in the number of group names. Why is this? This is due to the provisions in the C language, the array name represents the first address of the array. The entire array is a continuous memory unit at the beginning of the first address. If there is a character array char C [10], in memory can be represented as shown in Figure 4.2. The first address of the set group C is 2000, that is, the C [0] unit address is 2000. Then the array name c represents this first address. Therefore, the address operator cannot be added before C. If you write Scanf ("% s", & c); it is wrong. When performing a function printf ("% s", c), the group name c finds the first address, then outputs each character in the array until the string termination flag '/ 0' is encountered. String common function

The C language provides a rich string processing function, which can be roughly divided into a string, output, merge, modification, comparison, conversion, copying, and searching for several categories. Use these functions greatly reduce the burden of programming. The string function for inputting the output, should contain the header file "stdio.h" before use; use other string functions, the header file "string.h" should be included. Here is a few most common string functions. 1. String Output Function PUTS Format: PUTS (Character Group Name) Function: Output strings in the character array to the display. That is, the string is displayed on the screen #include "stdio.h" main () {static char c [] = "Basic / NDBASE"; PUTS (C);} static char c [] = "Basic / NDBASE"; PUTS (c); From the program, you can see that the translucent characters can be used in the PUTS function, so the output result is two lines. The PUTS function can be replaced by the Printf function. The Printf function is usually used when you need to output a certain format. 2. String Enter Function Gets Format: Gets (Characters Name Name) Features: Enter a string from the standard input device keyboard. This function gets a function value, which is the first address of the array of characters. #include "stdio.h" main () {char ST [15]; Printf ("INPUT STRING: / N"); Gets (st); PUTS (ST);} You can see that when you entered the string When the output is still all strings. The Gets function does not end the end of the string as a string, but only carries back as the input. This is different from the scanf function. 3. String Connection Function STRCAT Format: STRCAT (Characters Name 1, Character Group 2) Function: Connect the string in the character array 2 to the back of the character array 1, and delete the string 1 String sign "/ 0". This function return value is the first address of the character array 1. #include "string.h" main () {static char ST1 [30] = "my name is"; int St2 [10]; Printf ("Input Your Name: / N"); Gets (ST2); STRCAT (ST1 , ST2); PUTS (ST1);} static char ST1 [30] = "my name is"; int St2 [10]; Printf ("Input Your Name: / N"); Gets (ST2); STRCAT (ST1, ST2); This program connects the character array of initialization assignments to dynamically assigning strings. It should be noted that the character array 1 should define enough length, otherwise it is not possible to load the connected string 4. String copy function STRCPY format: STRCPY (Characters Name 1, Character Group Name 2) Features: Put the character number 2 The string in 2 is copied to the character array 1. The string end sign "/ 0" is also copied together. Number of characters 2, or a string constant. At this time, it is equivalent to giving a string to a character array. #include "string.h" main () {static char ST1 [15], ST2 [] = "c language"; strcpy (ST1, ST2); PUTS (ST1); Printf ("/ n");} static char ST1 [15], ST2 [] = "c language"; STRCPY (ST1, ST2); This function requires that the character array 1 should have enough length, otherwise it is not possible to load the copy string.

5. String comparison function strcmp format: strcmp (character number group name 1, character number 2) Function: Compare the strings in the two arrays according to the ASCII code order, and return the comparison result by the function return value. String 1 = String 2, return value = 0; string 2> string 2, return value> 0; string 1 0) Printf ("ST1> ST2 / N"); if (k <0) Printf ("" ST1}

{INT K;

Static Char ST1 [15], ST2 [] = "C Language";

Printf ("INPUT A String: / N");

Gets (ST1);

K = STRCMP (ST1, ST2);

IF (k == 0) Printf ("ST1 = ST2 / N");

IF (k> 0) Printf ("ST1> ST2 / N");

IF (k <0) Printf ("ST1

}

Compare the strings in the input string and array ST2 in this program, the comparison result is returned to K, and the result supper is output according to the K value. When the input is DBASE, "DBASE" is better than "C Language" since K> 0, and the output result "ST1> ST2" is available.

6. Test string length function strlen format: Strlen (character number group name) Function: The actual length of the string (without string end flag '/ 0') and returns a value as a function.

#include "string.h"

Main ()

{INT K;

Static char st [] = "c language";

K = Strlen (ST);

Printf ("The Lenth of The String IS% D / N", K);

}

Program example

Plug an integer in the magnitude of the array of sequences in order. In order to insert a number in an array of sequences, it should first determine whether the sort is from large to small or from small to large. Setting the sorting is from large to small, the number of desired plugs is compared to each number in the array. When the first element I is smaller than the insertion, it is the insertion position. Then start from the last element of the array to this element, and one unit is moved again. Finally, the plurality of insertions can be given. If the number of inserts is smaller than all element values, the last position is inserted. Main () {INT I, J, P, Q, S, N, A [11] = {127, 3, 6, 28, 54, 68, 87, 105, 162, 18}; for (i = 0; i <10; i ) {p = i; q = a [i]; for (j = i 1; j <10; j ) IF (Q

IF (p! = i)

{

s = a [i];

a [i] = a [p];

a [p] = s;

}

Printf ("% d", a [i]);

}

Printf ("/ Ninput Number: / N");

Scanf ("% d", & n);

For (i = 0; i <10; i ) IF (n> a [i])

{for (s = 9; s> = i; s -) a [s 1] = a [s];

Break;

a [i] = n;

For (i = 0; i <= 10; i )

Printf ("% d", a [i]);

Printf ("/ n");

}

Scanf ("% d", & n);

For (i = 0; i <10; i )

IF (n> a [i])

{for (s = 9; s> = i; s -) a [s 1] = a [s];

Break;

A [i] = n; This program firstly sorts the number of sequencing results from 10 numbers in array a. Then enter the integer n to be inserted. Retracence the n and array elements by one for statement, if there is n> a [i], the value of the elements below I below is changed by one unit. The post-transfer should be performed backward (start from A [9] to A [i]). The post-transfer end jumps out of the outside cycle. The insertion point is I, and the N is given to a [i]. If all elements are greater than being inserted, they have not been moved afterwards. At this time, i = 10, the result is to assign N to a [10]. The last array of the last loop output is inserted. When the program is running, the input number 47. As can be seen from the results, 47 has been inserted between 54 and 28.

The maximum element of each row is selected in the two-dimensional array A, which is selected into one-dimensional array B. A = 3 16 87 65 4 32 11 108 10 25 12 37B = (87 108 37) The programming idea of ​​this question is to find the largest element in each row of array A. After finding the value, the value is given the corresponding element accordingly. can. The procedures are as follows: main () {static int a [] [4] = {3, 16, 87, 65, 4, 32, 11, 108, 10, 25, 12, 27}; int B [3], I, J, L; for (i = 0; i <= 2; i ) {l = a [i] [0]; for (j = 1; j <= 3; J ) IF (a [i] [j]> L ) L = a [i] [j]; b [i] = L;} Printf ("/ NARRAY A: / N"); for (i = 0; i <= 2; i ) {for (j = 0 J <= 3; J ) Printf ("% 5d", A [i] [j]); printf ("/ n");} Printf ("/ Narray B: / N"); for (i = 0 ; i <= 2; i ) Printf ("% 5d", b [i]); printf ("/ n");} for (i = 0; i <= 2; i ) {L = a [i] [0]; for (j = 1; j <= 3; j ) IF (a [i] [j]> L) L = a [i] [j]; b [i] = L;} A FOR statement nests a FOR statement consists of a dual cycle. The external loop control progressive, and gives L. 0 column elements per row. After entering the internal cycle, the L is compared to the columns of the columns, and the larger than the L. At the end of the internal cycle, L is the largest element of the line, and then give the L value to B [I]. When all the external cycles are completed, the array B has been loaded into the maximum value in each row. The two two for statements are output to the array a and array b, respectively.

转载请注明原文地址:https://www.9cbs.com/read-127958.html

New Post(0)