Single v/s Multidimensional Array

Neha Shaikh
2 min readNov 3, 2019

The beginning of Data Structure Algorithm bounds by Array and it’s functionality as in the further lectures we’d gone through the Arrays and its Algorithm.

What is an Array?

In programming languages, an array is a way of storing several items . These items must have the same type (only integers, only strings, …) because an array can’t store different items. Every item in an array has a number so the programmer can get the item by using that number. This number is called the index. In Java , the first item has index 0, the second item has index 1 and so

When the programmer creates an array, he/she must give the size of the array. This is the number of items that can be stored in the array. If the programmer wants to store more items then he/she must create a new array. This is because the size of an array can’t be changed that is one of the disadvantage of Array.

Single and Multi dimensions :

A single dimension Array is a collection of variables with the same data type whereas the other one is ‘The Array of Arrays’ with each element of the array holding the reference of other array.

Declaration,

Single:

data_type[] name of array; (i.e int[] arr;)

Initialization,

Single:

int array[]={1,3,4,5,6,7};

Multi (two):

data_type[][] name of array; (i.e double arr[][];)

int array[][]={{1,3,4},{4,7,8},{7,8,9}};

The above is the very primary introduction to Array. Further I am gonna upload in my coming blogs.

Your feedback is highly appreciated.

--

--