Program will demonstrate deletion of an element from the linear array
/* declaration of delete_list function */
voiddelete_list(list *, int);
/* definition of delete_list function*/
/* Position of the element is specified by the user & the element is deleted from the list*/
voiddelete_list(list *start, int position)
{
int temp = position;
printf("\n information ought to remove:%d",l->data[position]);
while( temp <= start->count-1)
{
start->data[temp] = start->data[temp+1];
temp ++;
}
start->count = start->count - 1 ;
}
/* main function */
void main()
{
....................
...................
printf("\ninput the position of element you want to get rid of:");
scanf("%d", &position); fflush(stdin); delete_list(&l, position); traverse(&l);
}