<分区>
Possible Duplicate:
Why does this Seg Fault?
在 char * 上使用++ 运算符时收到段错误
#include<stdio.h>
int main()
{
char *s = "hello";
printf("%c ", ++(*s));
return 0;
}
但如果我执行以下操作:
#include<stdio.h>
int main()
{
char *s = "hello";
char c = *s;
printf("%c ", ++c);
return 0;
}
然后代码完美编译,请问上面的代码有什么问题?