Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - How to define array length with variables in C++
How to define array length with variables in C++
1. First, define a custom function to determine the length of a character array.

2. In the user-defined function, an integer variable I is defined to calculate the length of the character array.

3. In the function, the while loop is used to judge the length of the character array.

4. In the main function, first save an integer variable and save the calculated string array length.

5. Next, define a string array to store statistical strings.

6. Enter the statistical string and save it in the array str.

7. Calculate the length of the string array and save it in the variable n. ..

8. Finally, output the calculated string length.