[C language] 14-Character array of array

0. What is a character array?

In the previous study, I learned that character data is stored in the storage unit based on the ASCII code value of the character, which generally occupies 1 byte. Since the ASCII code also belongs to the integer form, in the C99 standard, the character type is classified as One of the integer types, and the character array can be understood as a special integer type array.
Since character type data is widely used, especially in the form of strings, a separate chapter is given. Explain character arrays
There is no string type or string variable in C language. Strings are stored in character arrays., readers need to pay attention to this

1. How to define a character array

A character array is a one-dimensional array of character type, so referring to the definition of a one-dimensional array, the following general form can be obtained:

char 数组名[常量表达式]

If you use char a[10], a character array of char type with a size of 10 is defined. Other precautions are the same as for one-dimensional arrays and will not be repeated here.

2. Initialization of character array

The initialization method is the same as that of a one-dimensional array. For specific methods, you can view the initialization method of a one-dimensional array. I will not go into details here. It
should be noted that the length of the array is specified in the character array and initialized. Initialized array elements, the system will automatically initialize them as\0

3. How to reference character array elements

of character array elements

Guess you like

Origin blog.csdn.net/FuckerGod/article/details/132408264