C and Pointers ("pointers on C") 8.1.11
A string, such as "Hello", is usually a string constant that can be used to assign a value to a character pointer, or to initialize it, equivalent to assigning the first address of the string constant to the pointer, such as:
char *p = "Hello";
Or
Char *p;
p= "Hello";
string of C++stl
String constants cannot write to read
However, when using "Hello" to initialize a character array, "Hello" is not a string constant, but rather an initialization list {' H ', ' e ', ' l ', ' l ', ' o ', ' s '}, at any other time, it represents a string constant. The array name is also a pointer constant, and you cannot assign a value to a constant. So
Char a[] = "Hello"; Correct, hello ", not a string constant, but equivalent to an initialization list
and
Char a[6];
A = "Hello"; Error,A is a pointer constant, cannot be modified, and certainly cannot be assigned a value
String str Initializes a str to a character array and a character array.