C Program to Delete an Element From array at desired position :
There we will see how to delete an element in array from specified location.
First we have to create an array of finite number of element and input the element in the array from user.
Now we choose the index position which is we want to delete. we take input from user which is 2.
Lets have a look on Algorithm and programming code
step 1 : start
step 2 : Enter Size of array
step 3 : Enter element from user in array
step 4 : Now we take an index value which is we want to delete
step 5 : If index value greater then size of array then show th msg "delete not possible"
step 6 : Else perform the deletion
step 7 : display the array element after deletion
step 8 : Stop execution
//there we take an array with 20 index
printf("Enter size of array: ");
printf("Enter Element in the arrayn", n);
for ( i = 0 ; i < n ; i++ )
printf("Enter index value which is you want to deleten");
if ( index >= n+1 )
printf("There in not Inputed index valuen");
for ( i = index - 1 ; i < n - 1 ; i++ )
array[i] = array[i+1];
printf("Array after deletion: n");
for( i = 0 ; i < n-1 ; i++ )
Enter the size of array: 5
Enter Element in array:
Enter index value which is you want to delete: 2
Array after deletion:
5 9 5 4
C Program to delete an existing element from array
How to delete an element from array
Delete element in array from specified location