看这个:
int main() {
char *verse = "zappa";
printf("%c\n", *verse);
// the program correctly prints the first character
*verse++;
printf("%c\n", *verse);
// the program correctly prints the second character, which in fact lies
// in the adjacent memory cell
(*verse)++;
printf("%c\n", *verse);
// the program doesn't print anything and crashes. Why?
return 0;
}
Run Code Online (Sandbox Code Playgroud)
为什么我的程序会崩溃,因为我尝试增加verse指向的值?我期待像ASCII表中的下一个字符.