array as output parameter ???

C

cmrchs

Hi,

I have a function that creates an array and want to use that array in the client.
but what is the syntax in C++.NET 2005 to specify an array as output param of a function ??

ref class Test
{
void OutputParam(array<int>^ intArr)
{
intArr = gcnew array<int>(3);
for(int i=0; i<intArr->Length; i++)
intArr = i*2;
}
};

Client :
r = gcnew Test();

array<int>^ intArr1 = nullptr;
r->OutputParam(intArr1);
for(int i=0; i<intArr1->Length; i++) --> CRASH
Console::Write(" {0}",intArr1);

I tried
void OutputParam(array<int>^ intArr)
void OutputParam(array<int>^^ intArr)

but nothing works...

thanks
Chris




**********************************************************************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top