Delete element in array

Q. Write a C program to delete a value or element in array and user should guide which value is deleted.


/*c program for delete a number in array*/

#define SIZE 50
int main()
 int arr[SIZE];
 int i,num,index;
 printf("Enter total number of element in array : ");
 scanf("%d", &num);
 for(i=0; i<num; i++)
  printf("Enter %d element : ",i+1);
 printf("\nEnter element number which you want to delete : ");
 scanf("%d", &index);
 if(index >= num+1)
   printf("\nElement not found!!");
  for(i=index-1; i<num-1; i++)
  printf("\n-- After deletion new array list --\n\n");
  for(i=0; i<num-1; i++)
 return 0;

/*************** Output *****************/
Screen shot of delete element in array

Related Programs:

  1. How to create array in C?
  2. How to calculate length of array?
  3. Insert new element in array
  4. Display array in reversing order
  5. Example of array C program

1 comment: