I have a simple program to calculate the volume of a cube. It runs fine, but the result I get is wrong. It comes out as "Y is 392". Can anyone help me understand why it is 392? I have just begun C, so I do not understand all of the code.
I realise this Macro is badly written, I am just trying to understand its behavior before I rewrite it.
#define CUBE(x) (x*x*x)
void main(void);
void main(void){
int x, y;
x = 5;
y = CUBE(++x);
printf("Y is %d
", y);
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…