VC++ 为什么会产生异常?
程序代码:
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); }