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
Printable View
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.
It is undefined.Quote:
Originally Posted by zouyu1983
You can go here and grab n1124 and look in section 6.4.5 or Annex J.