Meanings of strings at different levels
1. A string such as "ABC" in the source file
This is called a string literal constant, only inCode. This literal constant is internally linked, and the compiler allocates space for this string within each compilation unit. Because it is a constant, the memory space it is located in is usually not writable.
2. An array of characters ending with '/0' (ascii nul character. Or, more specifically, an array of characters ending with '/0' containing various ASCII printable characters. This is a string definition in the C language. It does not involve compilation or linking, but <string. h> and <stdio. h> many functions in the header file are processed on a time-based basis. When using strlen, strcpy, strdup, and other functions to identify a string, the condition is determined only by the presence of '/0. To a large extent, the existence of the so-called C-style string is embodied by the series of functions <string. h> and <stdio. h>.
The character array, char charray [arraysize], is a lower-level significance. It represents a continuous memory interval that contains char elements. Whether the content is a valid ASCII string and ends with '/0' does not affect its nature as a character array. When this array is allocated as a local or global variable, you can use the sizeof operator to obtain the space occupied by the entire array. This value is not necessarily the same as the strlen of the string contained in it, and is usually not equal.
Char * P =/* initialization */indicates a pointer to a char element. Unreference it to obtain a single char. Because c supports pointer arithmetic operations (+ + P; -- p; P + 2 for char * P), a char * can be used to conveniently access consecutive strings, therefore, char * is usually used to reference a string in a logical sense.