This C program is to delete an element from an array from a specified location/position.For example, if an array a consists of elements a={7,8,12,3,9} and if we want to delete element at position 3 then the new array would be a={7,8,12,9} (as array starts from index 0).
Logic:We start to iterate from the position from which we want to delete the element.The reason for this is so that all the elements after the element which is deleted will be shifted by one place towards the left.
Output:
Enter no. of elements for the array:
6
Enter 6 elements for the array:
25
369
258
365
12
4
Enter position of the element to delete:
5
Array after deleting element
25 369 258 365 4
need an explanation for this answer? contact us directly to get an explanation for this answer