I would have thought that the result would be 512, no idea of why is 392

I'll explain why I thought of 512

As you have a define, then the preprocessor would replace it before compiling it, so your code would be like this. (After preprocessing)

int main()

{

int x = 5;

int y = ( (++x) * (++x) * (++x) ); // Important Line

printf("y=%d\n",y);

}

When it gets to "Important Line", it does the following

the first ++x so x = 6

then the second ++x so x = 7

then the third ++x so x = 8

then it evaluates y = 8 * 8 * 8;

then y = 512;

The reason for Cubic( x++ ) = 125 is that in that case

first y is assigned and afterwards x is incremented, so the y value is not influenced by the autoincrement operators

Hope this helps

Tincho

I'll explain why I thought of 512

As you have a define, then the preprocessor would replace it before compiling it, so your code would be like this. (After preprocessing)

int main()

{

int x = 5;

int y = ( (++x) * (++x) * (++x) ); // Important Line

printf("y=%d\n",y);

}

When it gets to "Important Line", it does the following

the first ++x so x = 6

then the second ++x so x = 7

then the third ++x so x = 8

then it evaluates y = 8 * 8 * 8;

then y = 512;

The reason for Cubic( x++ ) = 125 is that in that case

first y is assigned and afterwards x is incremented, so the y value is not influenced by the autoincrement operators

Hope this helps

Tincho