C++ Function Parameter Passing by Pointer

Description

C++ Function Parameter Passing by Pointer

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



PreviousNext

Related