Binod's Blog

Tag: Delete Element in Array

Delete Element in Array

by on Dec.14, 2010, under C & C++, DSA in C, Tutorial

//WAP to DELETE element in an array using C and algorithm
#include<stdio.h>
#include<conio.h>
main()
{
clrscr();
int a[8]={1,2,3,4,5,6,7, },pos=0,val;
printf(“befor DELETE: “);
for(int i=0;i<8;i++){
printf(“%d”,a[i]);
}
printf(“\n Enter the position of the element to DELETE in array: “);
scanf(“%d”,&pos);
printf(“after DELETE: “);
pos=pos-1;
for(i=pos;i<8;i++){
a[i]=a[i+1] ;
}
for(i=0;i<8;i++){
printf(“%d”,a[i]);
}
getch();
return 0;
}

Leave a Comment :, , more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Blogroll

A few highly recommended websites...