+ 1
What's the difference between these three array?
int [ ] int [, ] int [ ] [ ]
1 Answer
+ 3
int[]
Single dimensional array. You can imagine it as a line, it has a fixed number of elements.
int[,]
Multidimensional array. You can imagine it as a grid, like an Excel table. It is square-shaped, so every row is the same size. You can even create arrays with 3 or more dimensions but those are a bit more difficult to visualize.
https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/arrays/multidimensional-arrays
int[][]
Jagged array. Similarly to multidim, you can think of it as a table, but each row in the table may have a different number of elements. That's why it's called 'jagged'.
https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/arrays/jagged-arrays