本文共 405 字,大约阅读时间需要 1 分钟。
#include int main(){ int i = 0; int a[] = {10,20,30}; int r = 1 * a[i++] + 2 * a[i++] + 3 * a[i++]; printf( "%d\n", r ); return 0;}输出为60.C语言标准,最新的是2011年出的C11,之前还有C99。The result of the postfix ++ operator is the value of the operand. As a side effect,the value of the operand object is incremented.后缀表达式++的结果是操作数的值。作为一个副作用,操作数对象的值将增加。而这个副作用的执行时期,取决于各个编译器,不同的编译器,执行的时期不一样。而gcc中,此例中,三次后缀操作符执行是在最后执行。因此,结果为60.转载地址:http://uqxvb.baihongyu.com/