Skip to content

Commit 3bd9f64

Browse files
committed
delete an element from array c-basics
1 parent 2039ae5 commit 3bd9f64

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

arraydelelement.c

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#include<stdio.h>
2+
main()
3+
{
4+
int n[100],m,i,temp,r,p,te,k;
5+
printf(" enter the number of values u want to enter : ");
6+
scanf("%d",&m);
7+
for(i=0;i<m;i++)
8+
{
9+
printf(" enter the value of n[%d] : ",i);
10+
scanf("%d",&n[i]);
11+
}
12+
printf(" enter the position u want to delete : ");
13+
scanf("%d",&p);
14+
for(i=p-1;i<m;i++)
15+
{
16+
n[i]=n[i+1];
17+
}
18+
m--;
19+
20+
for(i=0;i<m;i++)
21+
{
22+
printf(" \n enter the value of n[%d] : %d",i,n[i]);
23+
24+
}
25+
}

0 commit comments

Comments
 (0)