When pass a variable to a function, why the function only gets a copy/duplicate of the variable?
int n=1; void foo(int i) { i++; }
As
If you really want a function to change its actual parameter, you can pass it by reference in C++
void foo(int& i) { i++; }