If I call a function, that changes value of a variable, in std::cout and try to print that value then std::cout prints old value. Why?
If I try to output that value in the next cout-call, it'll print updated value.
#include <iostream>
int reset(int& v)
{
v = 0;
return 0;
}
int main()
{
int i = 5;
std::cout << reset(i) << " " << i; //output: 0 5
}
Expected output: 0 0