C++ examples for Function:Function Parameter
Demonstrate passing nonarrays by address.
#include <iostream> using namespace std; int do_fun(int &amt); int main()// www. j av a 2s . com { int amt; amt = 100; cout << "In main(), amt is " << amt << "\n"; do_fun(amt); cout << "After return, amt is " << amt << " in main()\n"; return 0; } int do_fun(int &amt) { amt = 85; cout << "In do_fun(), amt is " << amt << "\n"; return 0; }