The difference between a character array and a character pointer variable:
Char *"I Love china! " // It is legal to assign the first initial address of I love china! to the pointer variable a
However:
Char str["I Love china! " // It's illegal, not too easy to think.
The following errors are also true:
Char *A; scanf ("%s"// Illegal, attempt to enter a string from the keyboard and make a point to it, which is easy to understand, Nor does it open space to store it
This is the only way to be correct:
Char *a, str[= str;scanf ("%s", a); From the keyboard input string into a point of memory
The value of each element in the character array can be changed, and it can be assigned again, but the value of the string constant pointed to by the character pointer cannot be changed because the string constant is stored in the literal constant area and cannot be changed.
* Character Array *