I came across this problem in c++ randomly. By my understanding this code:
#include <iostream>
using namespace std;
void foo(int a, int b){
cout<<"a = "<<a;
cout<<"\n";
cout<<"b = "<<b; }
int main() {
int i = 1;
foo(++i,i++);
return 0; }
should print out:
a = 2
b = 2
But instead it prints out
a = 3
b = 1
How is that possible?