增量遞減

遞增和遞減運算子以字首字尾形式存在。

int a = 1;
int b = 1;
int tmp = 0;

tmp = ++a;        /* increments a by one, and returns new value; a == 2, tmp == 2  */
tmp = a++;        /* increments a by one, but returns old value; a == 3, tmp == 2 */
tmp = --b;        /* decrements b by one, and returns new value; b == 0, tmp == 0 */
tmp = b--;        /* decrements b by one, but returns old value; b == -1, tmp == 0 */

請注意,算術運算不會引入序列點 ,因此使用++-- 運算子的某些表示式可能會引入未定義的行為