cant initlialize jagged arrays

Trips

Well-known member
Joined
Aug 7, 2010
Messages
2,788
I am creating my first jagged arrays and understand what the documentation is talking about but even though my code is exactly the same as the online manual, I get errors stating I cant use the array variable as a type and so on. So I am confused as to why
VS 2010 complains about it so much.

Here is what I have so far:

<pre>// jagged arrays
int[][] jaggedArray1 = new int[2][];// declares a jaggedArray that holds 2 single dimension arrays inside of it.

// before using the jaggedArrays arrays must initialized first
int jaggedArray1[0] = new int[3];

int jaggedArray1[0] = { 1, 3, 5, 7, 9 };[/code]


I appreciate the help

View the full article
 
Back
Top