Delete element of array
simple pogram how to Delete element of array
#include<stdio.h>
#include<conio.h>
void main()
{
int a[10],p,i,j;
clrscr();
printf("Enter ten element in array\n");
for(i=0;i<10;i++)
scanf("%d",&a[i]);
printf("Enter position to delete element of array\n");
scanf("%d",&p);
for(i=0;i<p-1;i++)
{}
for(;i<9;i++)
a[i]=a[i+1];
printf("Resultant arry\n");
for(i=0;i<9;i++)
printf("%d ",a[i]);
getch();
}
simple pogram how to Delete element of array
#include<stdio.h>
#include<conio.h>
void main()
{
int a[10],p,i,j;
clrscr();
printf("Enter ten element in array\n");
for(i=0;i<10;i++)
scanf("%d",&a[i]);
printf("Enter position to delete element of array\n");
scanf("%d",&p);
for(i=0;i<p-1;i++)
{}
for(;i<9;i++)
a[i]=a[i+1];
printf("Resultant arry\n");
for(i=0;i<9;i++)
printf("%d ",a[i]);
getch();
}
0 comments: