**Array in Data Structure:-**

- Array is linear type of data structure.
**Definition**array is a set of similar type of (homogeneous) data.- The arrangement in an array in a systematic order as a sequential.
- An array stored in a systematic order it given and sequential index.
- Array index start with zero.
- Each array element can be accessed by its index.

Example:- suppose we have 10 number (similar type integers) are stored in array array1.

As we see array1 is started continuously and its index starts with 0.

**Initializing array:-**

It specifies the number of element we want to store that is size of array.

**Example:- arr[10];**

**Assigning:-**

This operation assigns a value to an array.

**Example:- arr[0]=1;**** arr[1]=2;**

**The operation performed on array**

- Adding element
- Deleting element
- Sorting element
- Searching element
- Re-arranging element
- For performing matrix operation

**Advantages of array**

- Collection of homogeneous element.
- It has index.
- We can access any element by index.
- To implement data structure like stack, queue.

**Disadvantages of array**

- We must know how many element to stored.
- The array is fixed size that is memory allocated to array can not be increased or reduced.
- As array fixed size, if we allocated more memory then we are using then memory will be wasted.
- Element in array are stored in consecutive memory location so insertion and deletion takes more time.

**Simple program using array**

1234567891011121314 | #include<stdio.h>void main(){int arr[5],j; // Initilizing arrayprintf(“Enter array:”);for(i=0;i<5;i++) // taking array input{scanf(“%d”,&arr[i]);}printf(“our array”);for(i=0;i<5;i++){printf(“%d”,arr[i]); // Printing our array} |

**Output of program**

**Enter array****10 20 30 40 50**

**our array****10 20 30 40 50**array in Data Structure

Array in Data Structure

Array in Data Structure