Passing value struct to function : Function parameter « Function « Visual C++ .NET






Passing value struct to function

 


#include "stdafx.h"
using namespace System;

value struct V
{
   int a;
   int b;
};

void f(V% v)
{
   v.a = 10;
   v.b = 20;
}

int main()
{
   V v;
   v.a = 1;
   v.b = 2;
   f(v);
   Console::WriteLine("{0} {1}", v.a, v.b);
}

   
  








Related examples in the same category

1.parameter passing
2.pass by reference
3.pass by value
4.param array parameter
5.Passing array as parameter