Array
Array
Arrays
What is an array?
o Array is a container which can hold a fix number of items and these items
should be of the same type.
Terms used in array:
o Element: Each item stored in an array is called an element.
o Index: Each location of an element in an array has a numerical index, which is
used to identify the element.
Arrays
Syntax:
In above example type code are the codes that are used to define the
type of value the array will hold.
Array
Array Operations:
o Traverse Operation
o Insertion Operation
o Deletion Operation
o Search Operation
o Update Operation
Arrays
Array Operations:
Traverse operation:
o This operation is used to print all the array elements one by one.
Example: Output:
Arrays
Array Operations:
Insertion operation:
o Insertion operation is used to insert one or more data elements into an
array.
Example: Output:
Arrays
Array Operations:
Deletion operation:
o Deletion refers to removing an existing element from the array and re-
organizing all elements of an array.
Example: Output:
Arrays
Array Operations:
Search operation:
o This operation searches an element using the given index or by the
value.
Example: Output:
Arrays
Array Operations:
Update operation:
o Update operation refers to updating an existing element from the
array.
Example: Output:
Thank You