//------------------------------------------------------------------------- // // cbv.cpp // // Written by: Simon Parsons // Last modified: 24th November 2007 // A program to illustrate call-by-value //------------------------------------------------------------------------- // // Headers #include using namespace std; //------------------------------------------------------------------------- // // Function definitions void myfun( int a ) { a++; cout << "inside myfun, a=" << a << endl; } //------------------------------------------------------------------------- // // main int main() { int a = 7; cout << "before calling myfun, a=" << a << endl; myfun( a ); cout << "after calling myfun, a=" << a << endl; } // end of main() // //-------------------------------------------------------------------------