1. Different end flags
String: must end with '\0'; // ?‘ \0 '? means "string terminator".
Character array: can contain multiple '\0', but if it is processed as a string, the actual valid string is the signed string of the first '\0', if it is processed as a character array , can process any character in the character array, and all characters can be '\0'.
2. Different characteristics
A string is similar to a character array in storage, so its individual elements can be extracted. For example, s="abcdefghij", then s [1]="b", s[9]="j".
The zero position of the string is exactly its length, such as s[0]=10 (※Ansistring does not have the above function.), which can provide us with a lot of convenience, such as high-precision operations. Bits can be converted into numbers and stored in arrays.
Character array refers to an array used to store character data. The general form of its definition is: char array name [data length]. Character arrays are used to store characters or strings. An element in a character array stores a character, which occupies one byte in memory. There is no string type in C language, strings are stored in character arrays.
Extended information:
String data type:
The string data type is a data type modeled on the idea of ??a formal string. String is a very important and useful data type that can be implemented in almost all programming languages.
They are available as primitive types in some languages ??and as composite types in others. The syntax of most high-level languages ??allows instances of the string data type to be represented by strings, usually quoted in some way; such metastrings are called "texts" or "string literals".
Initialization of character array:
There is no essential difference between the initialization of character array and the initialization of numeric array. But in addition to assigning characters to array elements one by one, it can also directly initialize them with strings.
Initialize the array one by one with character constants. For example: char a[8]={'i', 'l', 'o', 'v', 'e', ??'y', 'o', 'u'}; assign the 8 characters to These 8 elements are c[0]~c[7].
Baidu Encyclopedia--Character Array
Baidu Encyclopedia--String