C++ Function Parameter With References

Description

C++ Function Parameter With References

#include <iostream> 

using namespace std; 

void myFunction(int &myparam) 
{ 
  myparam = myparam * 2 + 10; //from   w  w w. j  a v  a2  s  . c  o m
} 

int main() 
{ 
  int mynumber = 30; 
  myFunction(mynumber); 
  cout << mynumber << endl; 
  return 0; 
}



PreviousNext

Related