C++ examples for Function:Function Parameter
When you pass an argument to a function, a copy of that argument is made inside the function.
#include <iostream> using namespace std; void f(int a) { cout << "a = " << a << endl; a = 5;/*from w w w . java 2 s . co m*/ cout << "a = " << a << endl; } int main() { int x = 47; cout << "x = " << x << endl; f(x); cout << "x = " << x << endl; }