为什么 ++str 和 str+1 有效而 str++ 无效?

Joe*_*Joe 6 c recursion c-strings post-increment function-declaration

我知道这里有一些关于 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);没有。为什么?

use*_*714 7

replace(str++, c1, c2); 方法:

replace(str, c1, c2);
str+=1;
Run Code Online (Sandbox Code Playgroud)

replace(++str, c1, c2);意味着:

str+=1;
replace(str, c1, c2);
Run Code Online (Sandbox Code Playgroud)