#include <iostream>
int a(int &x) {
x = -1;
return x;
}
int main () {
int x = 5;
std::cout << a(x) << " " << x << std::endl;
}
Why output is "-1 5"?
PS: compiler is:
i686-apple-darwin11-llvm-g++-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
PS: compiled without any optimization.