-1
int arr = new double[][] {
            new double[] {1, 2, 3, 4, 66},
            new double[] {5, 6, 7, 8, 66},
            new double[] {9, 10, 11, 12, 66},
            new double[] {13, 14, 15, 16, 66},
            new double[] {13, 14, 15, 16, 99}
          }

When trying to create the matrix this way I get the following error:

Argument 1: cannot convert from 'double[][]' to 'int[][]' [c##]

Chris Catignani
  • 5,040
  • 16
  • 42
  • 49
Darkhan Mukhtar
  • 137
  • 1
  • 7
  • 1
    why are you assigning to `int arr`? – h0r53 Sep 28 '20 at 19:25
  • 4
    `double[][]` is obviously not the same as `int`, so that assignment isn't valid. There's no issue here, use either `var arr` or `double[][] arr` – Camilo Terevinto Sep 28 '20 at 19:26
  • 1
    @CamiloTerevinto suggesting `var` to newbie is a crime :) – aepot Sep 28 '20 at 20:01
  • 1
    @aepot Answering a typo is an even worse crime :) This should be closed, and deleted. There's no good reason for this question. – Camilo Terevinto Sep 28 '20 at 20:04
  • @CamiloTerevinto i answered "matrix", not typo, really. Did you read the answer content? :) – aepot Sep 28 '20 at 20:08
  • 1
    @aepot Of course I did :) but there's still no good reason for this question. There's no error besides not understanding how the language works, and that's not the kind of questions we accept here, there are plenty of resouces readily available – Camilo Terevinto Sep 28 '20 at 20:12

1 Answers1

3

you used the wrong type in the assignment (int)..

 double[][] arr = new double[][] {
            new double[] {1, 2, 3, 4, 66},
            new double[] {5, 6, 7, 8, 66},
            new double[] {9, 10, 11, 12, 66},
            new double[] {13, 14, 15, 16, 66},
            new double[] {13, 14, 15, 16, 99}
          };

will work..

audzzy
  • 721
  • 1
  • 4
  • 12