Q:

Modifying a C string: access violation

Possible Duplicates:
Why does simple C code receive segmentation fault?
Modifying C string constants? 

Why does this code generate an access violation?
int main()
{
    char* myString = "5";
    *myString = 'e'; // Crash
    return 0;
}

A:

*mystring is apparently pointing at read-only static memory. C compilers may allocate string literals in read-only storage, which may not be written to at run time.

