我正在修改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
我不确定为什么第二行与第一行不匹配...