#include <iostream>
#include <cstring>
using namespace std;
int main() {
char *str = "hello";
while (*str) {
cout << *str;
*str++;
}
return 0;
}和
#include <iostream>
#include <cstring>
using namespace std;
int main() {
char *str = "hello";
while (*str) {
cout << *str;
str++;
}
return 0;
}双输出
hello为什么在str++更改输出之前不添加或删除deference操作符?
发布于 2013-12-20 10:54:17
*str++的意思是*(str++)。
由于您不使用该表达式的值,所以*没有任何效果。
发布于 2013-12-20 10:53:59
后缀++比去重引用操作符*具有更高的优先级,因此
*x++;是相同的
*(x++);它的作用与
x++;https://stackoverflow.com/questions/20701952
复制相似问题