Consider the following code:
int main() {
char *p = "abcd";
p[0] = 'x';
return 0;
}
Is it guaranteed by the standard to work in any environment?
I am worried that some compilers my decide to mark the memory where the string is stored as read only and attempting to modify it would generate a segmentation fault at runtime. However, on all environments I tested it, it worked.