所以cout执行顺序从右到左!!!
#include<iostream>
using namespace std;
int main()
{
int a[] = { 1,3,5,7,9 };
int* p[] = { a,a + 1,a + 2,a + 3,a + 4 };
int* p1 = a;
cout << "Test 1:-------------------------------" << endl;
cout << a[4] << "\t" << *(a+2) << "\t" << *p[1] << "\t" << **(p + 1) << "\t" << **(p + 1) + a[2] << "\t"
<< *(p + 4) - *(p + 0) << "\t" << *(a + 3) % a[4] << endl;
cout << "Test 2:-------------------------------" << endl;
cout << *(++p1) << "\t" << *(p1 + 2) << "\t" << *(++++p1) << endl;
cout << "Test 3:-------------------------------" << endl;
cout << sizeof(p1) << "\t" << sizeof(*p1) << "\t" << &p1 << "\t" << *p1 << endl;
return 0;
}
其中Test2出现了超空间的情况,这就是因为c中函数参数处理顺序-从右向左
它会先从右向左完成3次自加,然后从左往右按照我们想要的顺序进行输出。