parameter passing : Function parameter « Function « Visual C++ .NET






parameter passing

 

#include "stdafx.h"

void byvalue(int i)
{
   i += 1;
}
void byref(int& i)
{
   i += 1;
}
int main()
{
   int j = 10;
   System::Console::WriteLine("Original value: " + j);
   byvalue(j);
   System::Console::WriteLine("After byvalue: " + j);
   byref(j);
   System::Console::WriteLine("After byref: " + j);
}

   
  








Related examples in the same category

1.Passing value struct to function
2.pass by reference
3.pass by value
4.param array parameter
5.Passing array as parameter