The difference between C language string constant and string array

1. String constants can only be read, not modified; character arrays can be read and modified.
2. A string assigned in the form of a pointer can only modify the string pointer but not the content of the string, while a string in the form of a character array can modify every character in the string.
3. Summary: C language has two ways to represent character strings, one is character array and the other is character string constants. Their storage locations in memory are different, so that character arrays can be read and modified. Constants can only be read and cannot be modified.
Insert picture description here

Guess you like

Origin blog.csdn.net/qq_43353179/article/details/109353528