其实很简单,楼主这个试图修改指向常量字符串指针的操作在 C 语言规范里面是未定义行为,就是说你这样做了不保证会发生任何事,可能在这个平台的实现上正常工作,也可能在另个平台的实现上导致你电脑爆炸,楼上那些扯到什么 32 位汇编什么的完全就是不知所云。
The contents of the arrays are modifiable. On the other hand, the declaration
char *p = "abc";
defines p with type ''pointer to char'' and initializes it to point to an object with type ''array of char'' with length 4 whose elements are initialized with a character string literal. If an attempt is made to use p to modify the contents of the array, the behavior is undefined.
http://port70.net/~nsz/c/c99/n1256.html#6.7.8p32