Program for delete element from array.

/*****************************
WAP TO DELETE ELEMENT FROM
SPECIFIED POSITION IN AN ARRAY
******************************/
#include stdio.h
#include conio.h

void main()
{
int a[25],n,pos,i;
clrscr();
printf("Enter size of array: ");
scanf("%d",&n);
printf("Enter %d elements:\n",n);
for(i=0;in)
{
printf("\nElement cannot be deleted.");
}
else
{
for(i=pos-1;i
{
a[i]=a[i+1];
}
a[i]=0;
printf("\nThe New Elements are: \n");
for(i=0;i
{
printf("%d\t",a[i]);
}
}
getch();
}

No comments:

Post a Comment