This is a beginners question.
Following is the C++ code that I was working with
int main() {
int x=5, y=5;
cout<<x--;
cout<<",";
cout<<--x;
cout<<",";
cout<<y--<<","<<--y;
return 0;
}
When run in Turbo C++ 3.0 the following is the output displayed by the code:
5,3,4,4
When compiled with Code::Blocks on Windows (uses MinGW with GCC/G++) the following is the output displayed:
5,3,4,3
Previously, I have heard that sometimes different compilers behave differently to certain problems, but I don't understand why this result is being displayed. Since logically, as I think, the output should be:
5,3,5,3
Can you please tell me the reason for such output logically.
Thank you!