Arrays - Jagged - MultiDimensional

  • Thread starter Thread starter Ravi Singh (UCSD)
  • Start date Start date
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.
 
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.
 
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
 
Thank you for replying.

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