*a++ 和 *++a
++ 的优先级高于 *。
*a++ 等价于 *(a++);
*++a 等价于 *(++a);
#include <iostream>
using namespace std;
int main()
{
int test[] = {1, 2, 3, 4, 5};
int *a = test;
cout << *a++ << endl; // 输出1
cout << *a << endl; // 输出2
cout << *++a << endl; // 输出3
cout << *a << endl; // 输出3
}

浙公网安备 33010602011771号