Getting Started With Array Data Structure
· 5 मिनट में पढ़ें
Array is a collection of items of the same variable type that are stored at contiguous memory locations. It is one of the most popular and simple data structures used in programming. In this article, we have decided to provide a complete guide for Arrays, which will help you to tackle any problem based on Arrays.
In this blog, we'll break down:
- What is an Array: Array is a Linear Data Structure that Stores collection of items.
- Basic Terminologies of array like , , and .
- Declaration and Intialization of Array and its time and Space Complexity.
- Operation on Array
- Advantages and Disadvantages of Array
What is Array?
Array is a linear data structure that stores a collection of items of same data type in contiguous memory locations. Each item in an array is indexed starting with 0. We can directly access an array element by using its index value.
Basic Terminologies of Array:
-
:
- In an array, elements are identified by their indexes. Array index starts from 0.
-
:
- Elements are items stored in an array and can be accessed by their index.
-
:
- The length of an array is determined by the number of elements it can contain.
Declaration and Intialization of Array:
Arrays can be declared in various ways in different languages. For better illustration, below are some language-specific array declarations:
main.cpp
// This array will store integer type element
int arr[5];
// This array will store char type element
char arr[10];
// This array will store float type element
float arr[20];
