Passing by Pointer - C++ Function

C++ examples for Function:Function Parameter

Description

Passing by Pointer

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); // ww  w.  j av  a  2s .  co  m
        cout << sum << endl; 
  
        return 0; 
}

Result


Related Tutorials