1. Different end marks
String: must end with' \'; // ? ‘ \ ’? The meaning of is "string terminator".
character array: it can contain multiple' \', but if it is treated as a string, the actual valid string is the signed string of the first' \'; if it is treated as a character array, it can handle any character of the character array, and all characters can be' \'.
2. Different characteristics
A string is similar to a character array in storage, so a single element of each bit can be extracted. For example, s = "abcdefghij", then s [1] = "b" and s[9]="j ".
and the zero position of the string is exactly its length, for example, s[]=1(※ the above-mentioned function of Ansistring is not available. ), which can provide us with a lot of convenience, such as high-precision operation, each bit can be converted into a number and stored in an array.
a character array refers to an array used to store character data. The general form of its definition is: char array name [data length]. Character array is used to store characters or strings, and one element in the character array stores a character, which occupies one byte in memory. There is no string type in C language, and strings are stored in character arrays.
Extended data:
Data type of string:
The data type of string is the data type modeled on the idea of formal string. String is a very important and useful data type that can be realized in almost all programming languages.
they can be obtained as basic types in some languages and as compound types in others. The syntax of most high-level languages allows strings that are usually quoted in some way to represent instances of string data types; This meta-string is called "text" or "string text".
initialization of character array:
there is no essential difference between initialization of character array and initialization of numeric array. But it can not only assign characters to array elements one by one, but also initialize them directly 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 eight characters to the eight elements c[]~c[7] respectively.
Baidu encyclopedia-character array
Baidu encyclopedia-character string