Types of arrays

There are mainly three types of arrays:

  1. One Dimensional Array
  2. Two Dimensional Array
  3. Three-Dimensional Array
  • It is a list of the variable of similar data types.
  • It allows random access and all the elements can be accessed with the help of their index.
  • The size of the array is fixed.
  • For a dynamically sized array, vector can be used in C++

Representation of 1D array:

Representation of the 1D array

2. Two Dimensional Array:

  • It is a list of lists of the variable of the same data type.
  • It also allows random access and all the elements can be accessed with the help of their index.
  • It can also be seen as a collection of 1D arrays. It is also known as the Matrix.
  • Its dimension can be increased from 2 to 3 and 4 so on.
  • They all are referred to as a multi-dimension array.
  • The most common multidimensional array is a 2D array.

Representation of 2 D array:

Representation of 2D Array

3. Three-Dimensional Array:

Three Dimensional Array or 3D array in C is a collection of two-dimensional arrays. It can be visualized as multiple 2D arrays stacked on top of each other.

Representation of 3D array

Declaration of Three-Dimensional Array:

We can declare a 3D array with x 2D arrays each having y rows and z columns using the syntax shown below.

Syntax:

data_type array_name[x][y][z];




  • data_type: Type of data to be stored in each element.
  • array_name: name of the array
  • x: Number of 2D arrays.
  • y: Number of rows in each 2D array.
  • z: Number of columns in each 2D array.

Array Notes for GATE Exam [2024]

Arrays are fundamental data structures in computer science, and mastering them is crucial for success in the GATE exam. This article aims to provide concise yet comprehensive notes on arrays, covering essential concepts and strategies to help you tackle array-related questions in the GATE 2024 exam.

Table of Content

  • Introduction to Arrays
  • Basic terminologies of the array
  • Representation of Array
  • Types of arrays
  • Finding Adress of an Element in Array
  • Calculating the address of any element In the 1-D array
  • Calculate the address of any element in the 2-D array
  • Calculate the address of any element in the 3-D Array
  • Previously Asked GATE Questions on Arrays

Similar Reads

Introduction to Arrays:

An array is a collection of items of the same variable type that are stored at contiguous memory locations. It’s one of the most popular and simple data structures and is often used to implement other data structures. Each item in an array is indexed starting with 0....

Basic terminologies of the array:

Array Index: In an array, elements are identified by their indexes. Array index starts from 0. Array element: Elements are items stored in an array and can be accessed by their index. Array Length: The length of an array is determined by the number of elements it can contain....

Representation of Array:

The representation of an array can be defined by its declaration. A declaration means allocating memory for an array of a given size....

Types of arrays:

...

Finding Adress of an Element in Array

...

Calculating the address of any element In the 1-D array:

...

Calculate the address of any element in the 2-D array:

...

Calculate the address of any element in the 3-D Array:

...

Previously Asked GATE Questions on Arrays:

...

Contact Us