标签:编译器
#include <stdio.h> int main(void) { int j, i = 3; printf("j = %d\n", j = (++i) + (++i) + (++i)); i = 3; printf("j = %d\n", j = (i++) + (i++) + (i++)); i = 3; printf("j = %d\n", j = (++i) + (i++) + (++i)); return 0; } /* 结果: * j = 16 * j = 9 * j = 13 * */
#include <stdio.h> #define SQUARE(x) ((x)*(x)) int main(void) { int a = 5; int b, c; b = SQUARE(a++); a = 5; c = SQUARE(++a); printf("b: %d, c: %d\n", b, c); a = 5; b = (a++)*(a++); a = 5; c = (++a)*(++a); printf("b: %d, c: %d\n", b, c); a = 5; b = (a++)*(a++)*(a++); a = 5; c = (++a)*(++a)*(++a); printf("b: %d, c: %d\n", b, c); a = 5; b = (a++)*(a++)*(++a); a = 5; c = (++a)*(a++)*(++a); // 6*6*7 ??? a = 5; c = (++a)*(a++); // 6*6 ??? printf("b: %d, c: %d\n", b, c); return 0; }
b: 25, c: 49
b: 25, c: 49
b: 125, c: 392
b: 150, c: 36
++ 表达式计算有什么规律?
编译器相关吗?
标签:编译器
原文地址:http://blog.csdn.net/ganggexiongqi/article/details/40054239