Lets say I have the following code
#include <iostream>
int main() {
int i = 3;
std::cout << ++i << " " << i++;
}
Since the first increment is done before, and the second one after, I expected that code to output this:
4 4
And if not, I would have expected it to at least output this:
5 5
But instead what I get is:
5 3
which makes no sense what so ever. What is going on? I compiled it with
g++ -std=c++14 test.cpp -o test