Arrays - Jagged - MultiDimensional

R

Ravi Singh (UCSD)

Hello all

I am trying to use jagged and multi-dimensional arrays in C++.

In C# these work fine
// for jagged arrays
string [][] jaggedArray = new string [3][];

//for multidimensional arrays
string [,] multidimensionalArray = new string[3,3]

In C++
//for jagged arrays
String* jaggedArray[][] = new String*[3][];

error C2691: 'System::String __gc * __gc[]' : invalid type for __gc
array element

//for multidimensional arrays
String*[,] multidimensionalArray = new String*[3,3];
I am not sure whats going on.

Thanks,

-Ravi Singh.
 
R

Ravi Singh (UCSD)

Eh whoops. Multidimensional array are declared in c++ like this.
Int32 pn[,] = new Int32[3,2];
so, i am still stuck on my original problem of having jagged arrays.
 
R

Ronald Laeremans [MSFT]

Hi Ravi,

Jagged arrays are not supported in 7.0 and 7.0 for C++. You will need a
wrapper in C# that translates from a jagged array to a rectangular array.

Ronald Laeremans
Visual C++ team
 
R

Ravi Singh (UCSD)

Thank you for replying.

After trying I arrived at a similar solution much to my dismay.
-Ravi Singh.
 

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