C语言中的“printf”和C++中的“cout”计算参数时都是从右到左进栈的,也就是从右到左运算。如下面的例子:
#include <iostream>
#include <stdio.h>
using namespace std;
int main()
{
int a[] = {2, 3, 4, 5, 6};
int *ptr = a;
*(ptr++) += 25;
printf("%d, %d\n", *ptr, *(++ptr));
cout << *ptr << “," << *(++ptr) << endl;
return 0;
}
输出结果应为:4,4;5,5;