Passing by Reference - C++ Function

C++ examples for Function:Function Parameter

Description

Passing by Reference

Demo Code

#include <iostream> 
  
using namespace std; 
  
void ReturnSum(int inValueA, int inValueB, int& outValue) 
{ 
        outValue = inValueA + inValueB; 
} 
int main(int argc, char *argv [])
{ 
        int sum = 0; 
        ReturnSum(3, 6, sum); /*  w w w  . ja  v a 2  s.  c  om*/
        cout << sum << endl; 
  
        return 0; 
}

Result


Related Tutorials