char *p = "i come from china";
does it allocate in the stack,or static area of the memory?
does the standard define the behavior that modifys the value of the string like this?
thanks
char *p = "i come from china";
does it allocate in the stack,or static area of the memory?
does the standard define the behavior that modifys the value of the string like this?
thanks
A string literal like that will be stored in the program's data segment. As far as addresses go, I'd say that it's likely to be near where your static data is stored. As a string literal, it may be placed in a "read-only" area of memory and attempts to alter the data may result in a program crash or other wonderful things.
"Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
-Christopher Hitchens