Menu Driven Array Operations

Here, we will write a single Menu Driven Program for the operations -
Insert, Delete, Traverse and Merge upon an array in C Language.

Algorithm

Insertion

  1. Input the array elements, the position of the new element to be inserted and the new element.
  2. Insert the new element at that position and shift the rest of the elements to right by one position.

Deletion

  1. Input the array elements, the position of the new element to be inserted and the new element.
  2. Delete the element and shift the rest of the elements to left by one position.

Traversal

  1. Start a loop from 0 to N-1, where N is the size of array.
  2. Access every element of array with help of
  3. Print the elements.

Merging

  1. To merge any two array in C programming, start adding each and every element of the first array to the third array (target array).
  2. Then start appending each and every element of the second array to the third array (target array) as shown in the program given below.

Program using C