Initialization of string variables in vc

When programming in C language in VC, the string variable char* str cannot be initialized with a constant string, and can only be assigned an initial value byte by byte, or declared as char str[ ] in the form of a character array, otherwise, the value of this variable will be changed later When prompted, the memory cannot be changed.

For example: char *str = "aasdasd"; *str can be changed in tc, but *str is an immutable character constant in vc.

Another: In tc, const char *str = "aasdasd"; makes *str a constant. 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325849537&siteId=291194637