String literals are stored in a read-only data segment of the binary. So the runtime error is because you're trying to change something you aren't supposed to.
There's no compiler error as you are, unfortunately, allowed to assign a non-const char* to point at a literal to support legacy code. Ideally your compiler should warn you about this!
To avoid the probem, store your string in a buffer.
1 2 3
char buffer[16] = "aaa"; // copy "aaa" into a buffer of 16 chars
char* a = buffer;
*a++ = 'd';
thank you, but i'm going to push it little further,
you said that it's a constant ok i get it. is there anyway to break it constness
such as cons_cast, if we can't could you describe it??
thank you!!
thank you andy for the information then i mark it solved!!