double[][]
is jagged. It's literally an array of arrays.
double[,]
is multidimensional. It gets special compiler treatment.
They have different memory layouts. double[][]
is an array which holds references to the other arrays, while double[,]
is laid out single-dimensionally for easier use.
Another difference is what data they can hold. A jagged array can be like this:
1231243245345345345345
23423423423423
2342342343r234234234234234234
23423
While a multidimensional array has to be a perfect table, like this:
34534534534534
34534534534533
34534534534534
34534534534545
A way to get around it would be to use nullable int
s.
Now, to solve your problem:
Change your method signature to public void verifymarks(double[,] marks)
and in the method change anything that uses marks[x][y]
to marks[x,y]
.