1. strlen (char * Str) returns the number of characters except the ending character/0 in Str.
2. The system will open up a piece of memory in the string area for all strings "", both global and local. For example:
Char * P = "hello ";
The system opens a memory for hello and Points P to the memory.
3. The = cannot be used to initialize the dynamically allocated string. strcpy should be used. For example, append world to the end of Hello:
// The correct method
Char * P = (char *) malloc (11 );
Char * STR = "world ";
Strcpy (P, "hello");/* assign a value like this */
Strcat (p, STR );
// Incorrect method
Char * P = (char *) malloc (11 );
Char * STR = "world ";
P = "hello";/* only change the storage area (from the heap area to the String constant area) referred to by P, but the newly allocated string is not initialized */
Strcat (p, STR );
5. strcat (char * str1, char * str2) does not dynamically increase the length of str1, when calling the strcat function, ensure that the target string has enough length to accommodate the entire string connected by the target string and the source string. In addition, str1 cannot be a null string,