See the example
# Include <iostream> using namespace STD; void main (void) {// The difference between char * A and char a [] char * A = "abcdef "; // A is a pointer and its value can be changed. Now a points to a constant string cout <A <Endl; A = "ghijkl "; // a now points to another constant string // A [0] = 'Z'; // A points to a constant. Compilation is fine, however, a cout <A <Endl; cout <sizeof (a) <Endl; // 4 char B [] = "abcdef "; // B is the first address of the array and a constant. Its value cannot be changed. The content is not the constant string cout <B <Endl; // B = "ghijkl"; // compilation fails, and B is the constant, you cannot specify other values for B [0] = 'Z'; cout <B <Endl; cout <sizeof (B) <Endl; // 7 // character // difference between const char * A and char * const a char C [] = "ABCD"; char d [] = "efgh "; const char * Pc = C; // PC [0] = 'Z'; // compilation error. PC is a pointer to a constant, make cout <Pc <Endl; Pc = D; cout <Pc <Endl; // inside the content pointed by the PC The content cannot be changed, but it can be changed to Char E [] = "ABCD"; char f [] = "efgh"; char * const Pe = E; // Pe = F; // PE is a constant pointer and cannot be changed to PE [0] = 'Z'; // PE is a constant pointer, although it cannot be changed, however, you can modify the content to point to cout <PE <Endl ;}// Conclusion: (1) char * A in this form: A is a pointer, and you can change its direction, // The string it points to is a constant and cannot be modified. // (2) in the form of char a [], A is an array name, A is a constant, and cannot point to other strings, but the content it points to is not a constant string, // It can be changed. // (1) const char * A is a pointer to a constant and the content is a constant. // It cannot be modified, but can be changed, this form is also equivalent to // char const *. // (2) char * const A is a pointer constant, which cannot be changed but can be // modified. // (3) const char * const A is a constant pointer to a constant, that is, it cannot be // changed or changed.