ProAnswers.org

Write a C program to perform deleting element in an Array?

#include

#include 

void main() 

{ 

int num[20],j,p,n,s; 

clrscr(); 

printf(“enter the number of elements

”);

scanf(“%d”,&n); 

printf(“enter the elements of array

”);

for(j=0;j

scanf(“%d”,&num[j]); 

printf(“enter the position to delete

”);

scanf(“%d”,&p); 

p--; 

for(j=p;j

num[j]=num[j+1]; 

for(j=0;j

printf(“%d”,num[j]); 

getch(); 

} 

Output: 

enter the number of elements 

3 

enter elements 

1 

2 

3 

enter the position to delete 

2 

1 3