C++ Pointer passing non arrays by address.

Description

C++ Pointer passing non arrays by address.

#include <iostream>
using namespace std;
do_fun(int &amt);  
int main()/*  www .  j  av  a 2s.  c om*/
{
   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;
}
do_fun(int &amt)   
{
   amt = 85;       
   cout << "In do_fun(), amt is " << amt << "\n";
   return 0;
}



PreviousNext

Related