- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What are the differences between a multi-dimensional array and jagged array?
Multi-dimensional array
Multi-dimensional arrays are also called rectangular array. You can define a 3-dimensional array of integer as −
int [ , , ] val;
Let us see how to define a two-dimensional array.
int[,] val = new[3,3]
Jagged array
A Jagged array is an array of arrays. To access an element from it, just mention the index for that particular array.
Here, we have a jagged array with 5 array of integers −
int[][] a = new int[][]{new int[]{0,0},new int[]{1,2}, new int[]{2,4},new int[]{ 3, 6 }};
Advertisements