Look at this code the code below it has a strange behavior the output should be 18 but when i try to compile and run it in Turbo C or in Code::Block the output is 19 instead of 18.
int main() {
int n=4, x;
x = ++n + ++n + ++n;
printf("%d", x);
return 0;
}
Can some explain it to me How the output is 19 instead of 18.
Note: when i try to run same code in java the output is 18 as expected.
But in c/c++ the output is 19 please explain
Thanks in Advance.