It is actually the difference between the values of char SZ [] = "string"; and char * psz = "string.
First, let's talk about Char SZ [] = "string"; this statement is stored one by one in the form of arrays. The Compiler interprets it
Char SZ [] = {'s ', 't', 'R',' I ', 'n', 'G','/0 '}; if it appears inside the function, these characters are stored in the stack, so it is not a String constant.
Let's talk about char * psz = "string"; this statement defines a pointer to the "string" string, and there is no space to store the "string" string, obviously, "string" is the most suitable choice to coexist as a String constant in the constant area. And the statement psz [4] = 'X'; no error is reported during compilation and an exception occurs during execution. The reason is that "string" is stored in the read-only storage area and cannot be modified. This is the same as const char * psz = "string" in C ++. Therefore, it is best to add the const keyword to the display so that the compiler can detect the "Modify constant" error.
What should I do if the row parameters in a function are arrays?
For example, void Foo (char SZ [100], int ival [10]);
The answer is to understand it as a pointer:
Void Foo (char * SZ, int * ival );
TheArticleReproduced from the network base camp: http://www.xrss.cn/Dev/C/200711217303.Html