Saral Code logo
Saral Code
    HomeBlogTutorialsMCQs

No Related Topics Available


An Array is a container that can hold a fixed number of items and these items should be of the same type. Most of the data structures use arrays to implement their algorithms.

Following are the important terms to understand the concept of Array.

  • Element: - Each item stored in an array is called an element.
  • Index: - Each location of an element in an array has a numerical index, which is used to identify the element.

Array Representation

Array Representation in Data Structure and Algorithm - DSA

As per the above illustration, the following are the important points to be considered.

  • The index of the array starts with 0.
  • The length of the array is 10 which means it can store 10 elements.
  • Each element can be accessed via its index. For example, we can fetch an element at index 5 as 12.

Syntax in Different Languages

#include<stdio.h>

void main(){
  int array [10] = {5,8,4,6,75,12,32,11,46,3};
}

Basic Operations

Following are the basic operations supported by an array.

  • Traverse − print all the array elements one by one.
  • Insertion − Adds an element at the given index.
  • Deletion − Deletes an element at the given index.
  • Search − Searches an element using the given index or by the value.
  • Update − Updates an element at the given index.