我知道这里有一些关于 p++、++p 和 p+1 之间区别的解释,但我还不能清楚地理解它,尤其是当它不使用该函数时:
void replace(char * str, char c1, char c2){
if (*str == '\0') {
return;
}else if (*str == c1) {
printf("%c", c2);
}
else {
printf("%c", *str);
}
replace(++str, c1, c2);
}
Run Code Online (Sandbox Code Playgroud)
当我这样做replace(++str, c1, c2);或replace(str+1, c1, c2);它有效时,但replace(str++, c1, c2);没有。为什么?