0

I am trying to create an int array of arrays as follows:

int[][] results = new int[3][3];

I keep getting this compiler error: "error CS0029: Cannot implicitly convert type int' toint[][]'"

I can create a single dimension (int[]) or multi dimensional array (int[3,3]) without issue. I'm following the documentation on MSDN and elsewhere. Can someone tell me what I'm doing wrong?

T_Part
  • 1
  • 1

1 Answers1

1

Do this instead:

int[][] results = new int[3][];
for (int i = 0; i < results.Length; i++)
    results[i] = new int[3]; 
adjan
  • 13,371
  • 2
  • 31
  • 48