C Program to Delete an Element from an Array

/* C Program to Delete an Element from an Array */
#include <stdio.h>
int main()
{
int Array[10], Position, i, Size;
printf(“\n Please Enter Number of elements in an array  :   “);
scanf(“%d”, &Size);
printf(“\n Please Enter %d elements of an Array \n”, Size);
for (i = 0; i < Size; i++)
{
    scanf(“%d”, &Array[i]);
    }
  printf(“\n Please Enter a Valid Index Position of a Element that you want to Delete  :  “);
  scanf(“%d”, &Position);
  for (i = Position-1; i <= Size-1; i++)
    {
    Array[i] = Array[i + 1];
    }
    Size–;
  printf(“\n Final Array after Deleteing an Array Elemnt is:\n”);
  for (i = 0; i < Size; i++)
  {
  printf(“%d\t”, Array[i]);
  }
  return 0;
}

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>