#include <stdio.h>
#define square(x) x*x
int main() {
for (int i = 0, j = 0; i < 10; ++i, ++j) {
int a = square(i + j);
printf("square(%d + %d) = %d\n", i, j, a);
}
return 0;
}
在竞猜网站上观看了类似的代码后,我编写了上面的代码,上面的代码的输出确实很奇怪。如果您能解释发生了什么,将不胜感激。
在GCC编译器上,输出如下所示
square(0 + 0) = 0
square(1 + 1) = 3
square(2 + 2) = 8
square(3 + 3) = 15
square(4 + 4) = 24
square(5 + 5) = 35
square(6 + 6) = 48
square(7 + 7) = 63
square(8 + 8) = 80
square(9 + 9) = 99