C++ examples for Function:Function Parameter
Passing a Structure to a Function
#include <iostream> using namespace std; struct SumParameters { int valueA; int valueB; int result; }; //from w w w .j a v a 2s . com void ReturnSum(SumParameters& params) { params.result = params.valueA + params.valueB; } int main(int argc, char *argv []) { SumParameters sum; sum.valueA = 3; sum.valueB = 6; sum.result = 0; ReturnSum(sum); cout << sum.result << endl; return 0; }