VC++ 为什么会产生异常?
![](zzz/editor/img/code.gif)
void f(char *s) { printf("1:s=%s\n", s); char *p = s; *(p+1) = 'A'; printf("2:s=%s s[1]=%c\n", s, s[1]); // 应该输出:1A23456789 } int main() { int a = 0; char *s = "123456789"; char q[] = "123456789"; f(s); printf("---------------------------------------------------\n"); f(q); }
![](http://bbs_bccn_net.bccnsoft.com/006/month_1612/20161202_a6e5fda805a320616344eKgRR7oQKokU.jpg)