我正在修补 C++ 指针算法,一些奇怪的事情开始发生。
int myint[] = {1,2,3,4};
int * pmyint = myint;
pmyint = &myint[0];
cout << *(pmyint) << " " << *(pmyint+1) << " " << *(pmyint+2) << " "<< *(pmyint+3) << endl;
cout << *(pmyint++) << " " << *(pmyint++) << " " << *(pmyint++) << " "<< *(pmyint) << endl;
这段代码的输出是:
1 2 3 4
3 2 1 4
我不确定为什么第二行与第一行不匹配...