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
- Input the array elements, the position of the new element to be inserted and the new element.
- Insert the new element at that position and shift the rest of the elements to right by one position.
Deletion
- Input the array elements, the position of the new element to be inserted and the new element.
- Delete the element and shift the rest of the elements to left by one position.
Traversal
- Start a loop from 0 to N-1, where N is the size of array.
- Access every element of array with help of
- Print the elements.
Merging
- To merge any two array in C programming, start adding each and every element of the first array to the third array (target array).
- Then start appending each and every element of the second array to the third array (target array) as shown in the program given below.