+ 1

What's the difference between these three array?

int [ ] int [, ] int [ ] [ ]

15th Nov 2022, 6:12 AM
Mozzie
Mozzie - avatar
1 Antwort
+ 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
15th Nov 2022, 6:40 AM
Tibor Santa
Tibor Santa - avatar