#include<stdio.h>
#include<conio.h>
main()
{
int n,a[100],i,j,d,*P;
printf("enter the size of array\n");
scanf("%d",&n);
printf("enter the elements of array\n");
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
printf("enter the place to delete");
scanf("%d",&d);
printf("elements after deletion\n");
P=&a[d-1];
for(i=d-1;i<n;i++)
{
*P=a[i+1];
P++;
}
for(i=0;i<n-1;i++)
{
printf("%d\n",a[i]);
}
getch();
}
#include<conio.h>
main()
{
int n,a[100],i,j,d,*P;
printf("enter the size of array\n");
scanf("%d",&n);
printf("enter the elements of array\n");
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
printf("enter the place to delete");
scanf("%d",&d);
printf("elements after deletion\n");
P=&a[d-1];
for(i=d-1;i<n;i++)
{
*P=a[i+1];
P++;
}
for(i=0;i<n-1;i++)
{
printf("%d\n",a[i]);
}
getch();
}
No comments:
Post a Comment