- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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
Difference Between One-Dimensional (1D) and Two-Dimensional (2D) Array
In this post, we will understand the difference between one dimensional array and two dimensional array.
One dimensional array
It helps store a single list of elements that are similar data type.
The total bytes is calculates as the product of the datatype of variable array and the size of the array.
C++ declaration
type variable_name[ size ];
Java declaration
type variable_name [ ]; variable_name = new type[size];
int [ ] a = new int [10];
Two-Dimensional array
It helps store 'list of lists' or 'array of arrays' or 'array of one dimensional arrays', i.e nested arrays.
The total bytes is equivalent to product of datatype of variable array and size of first index and size of the second index.
C++ declaration
type variable_name[size1][size2];
Java declaration
type variable_name = new int[size1][size2];
type variable_name = new int[size1][size2];
- Related Articles
- Split one-dimensional array into two-dimensional array JavaScript
- Get the Inner product of a One-Dimensional and a Two-Dimensional array in Python
- Java Program to convert array to String for one dimensional and multi-dimensional arrays
- Explain the concept of one and two dimensional array processing using C language
- Explain pointers and one-dimensional array in C language
- Compute the bit-wise AND of a One Dimensional and a zero-dimensional array element-wise in Numpy
- Explain pointers and two-dimensional array in C language
- Transpose of a two-dimensional array - JavaScript
- Passing two dimensional array to a C++ function
- How to print one dimensional array in reverse order?
- What is a one-dimensional array in C language?
- What are the differences between a multi-dimensional array and jagged array?
- Dimensional Array in C#?
- How to declare a two-dimensional array in C#
- C# program to Loop over a two dimensional array

Advertisements