* 和++优先级是同一级别,同一级别按照从右往左的顺序计算
所以: *p++等价于*(p++)
1 #define debug(x) cout << #x << " at line " << __LINE__ << " is: " << x << endl 2 #include3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 using namespace std;10 11 int main()12 {13 char *a="this a book";14 char *p = a;15 p++;16 printf("%c\n", *p);//output:h17 *p++;18 printf("%c\n", *p);//output:i19 // overflow20 char x = (*p)++;//Bad permissions for mapped region at address 0x4008D721 printf("%d\n", x);22 23 while (*p != '\0') { // "\0" 转义字符,代表空字符串24 printf("%c", *p++);//is25 }26 printf("\n");27 return 0;28 }