C language: several forms of pointers, several types of C language pointers
Two types of strings:
1. character array char name [32] = "zhangsan"; // strcpy (name, "lisi") can only be performed during initialization "); // The overall value can only be assigned through strcpy name = "lisi"; // error, assign the address of a constant string ("lisi") to the constant pointer (char * const name) 2. Character pointer char * name = "zhangsan"; // the pointer variable name points to the starting address of the constant string char * name; // use a wild pointer (uninitialized pointer) scanf ("% s", name); // error, strcpy (name, "lisi"); // error. If the name points to a constant string, it will collapse. If the name is not initialized, the program may collapse or overwrite the data in the memory. Name = "lisi"; // OK. Modify the pointer to a new string address. 1. const int * p and int const * p: they have the same meaning. The content to be directed to is read-only data. q cannot be changed, but the address to be directed can be changed. 2. int * const p: the pointer must be initialized first, and the address to which the pointer is directed is read-only and cannot be changed. However, the content to which the pointer is directed can be changed. 3. const int * const p: neither the address or content pointed to by the pointer can be changed.