# One-Dimensional (1D) Array vs. Two-Dimensional (2D) Array

The difference between a one-dimensional array and the two-dimensional array is that one-dimensional array store single list of elements of similar data whereas in two-dimensional array list of lists or array of arrays is stored.

The array is a data structure that is very important in computer programming. In computer programming, array and structure are a very important concept. The array has elements of same data type and size in the array is also fixed. The array is declared with an array name and array is created with square brackets. One-dimensional array store single list of elements of similar data whereas in two-dimensional array list of lists or array of arrays is stored

A one-dimensional array is also known as a single-dimensional array. There is a list of variables of similar data types. In one-dimensional array elements are retrieved by using the index.  If we talk about how memory is allocated to a one-dimensional array, then it is allocated by defining the size of the array at the start of the code. Every programming language has its own way of defining array if we talk about C++ programming language then the one-dimensional array is defined as type variable_name[size]; the size of the array is defined in the bracket. Size is the number of element that array will hold.

A multidimensional array is supported in C++ and Java programming language. A multidimensional array is also known as 2-D array commonly. One-dimensional array se list of list and the multi-dimensional array is an array of array. There should be array name with square brackets where the second index is the second set of the square bracket.  As it is 2-D array, it is stored in the form of a row-column matrix. In this row-column matrix, the row is the first index and column is the second index.

### Comparison Chart

 Basis One-Dimensional (1D) Array Two-Dimensional (2D) Array Meaning one-dimensional array store single list of elements of similar data In two-dimensional array list of lists or array of arrays is stored. Size Size of one-dimensional (1D) array is Total Bytes =sizeof(datatype of array variable)* size of array. Size of two-dimensional(2D) array is Total Bytes= sizeof(datatype of array variable)* size of first index*size of second index. Dimension One-dimensional(1D) array is one dimension Two-dimensional (2D) array is two dimension. Row column matrix There is no row column matrix in one-dimensional (1D) array. There is row and column matrix in two-dimensional(2D) array

### One-Dimensional (1D) Array

One-dimensional array is also known as single-dimensional array. There is a list of variables of similar data types. In one-dimensional array elements are retrieved by using index.  If we talk about how memory is allocated to one-dimensional array then it is allocated by defining size of the array at the start of the code. Every programming language has its own way of defining array if we talk about C++ programming language then one-dimensional array is defined as type variable_name[size]; size of the array is defined in bracket. Size is the number of element that array will hold.

### Two-Dimensional (2D) Array

A multidimensional array is supported in C++ and Java programming language. A multidimensional array is also known as 2-D array commonly. One-dimensional array se list of list and the multi-dimensional array is an array of array. There should be array name with square brackets where the second index is the second set of the square bracket.  As it is 2-D array, it is stored in the form of a row-column matrix. In this row-column matrix, the row is the first index and column is the second index.

### Key Differences between One-Dimensional (1D) Array and Two-Dimensional (2D) Array

1. One-dimensional array store single list of elements of similar data whereas In two-dimensional array list of lists or array of arrays is stored.
2. Size of one-dimensional (1D) array is Total Bytes =sizeof(datatype of array variable)* size of array whereas Size of two-dimensional(2D) array isTotal Bytes= sizeof(datatype of array variable)* size of first index*size of second index.
3. One-dimensional(1D) array is one dimension whereas Two-dimensional (2D) array is two dimension.4
4. There is no row column matrix in one-dimensional (1D) array whereas there is row and column matrix in two-dimensional(2D) array

### Conclusion

In this article above we see the clear difference between the one-dimensional array(1D) and two-dimensional array(2D) with implementation.