write a program to delete an item from a particular location
of an linear array?

Answer Posted / ajith.s uit adoor(2008-2011)

#include<stdio.h>
#include<conio.h>
void main()
{

int i,j,item,n,a[10],u,k;clrscr();

printf("enter the limit\n");
scanf("%d",&n);
if(n>=10)
{
printf("Array exceed limit .correct the limit value below
10 \n");
}
else
{

printf("enter the position\n");
scanf("%d",&k);
if(k<=n||k<=10)
{
printf("enter the terms\n");
for(i=1;i<=n;i++)
{
scanf("%d",&a[i]);
}
printf("inserted list\n");
for(i=1;i<=n;i++)
{
printf("%d\n",a[i]);
}
printf("inser list\n");

for(i=k;i<=n-1;i++)
{
a[i] =a[i+1];

}
for(i=1;i<n;i++)
{
printf("%d\n",a[i]);
}
}
else
{
printf("postion given in below limit not equal to \n");
}
}
getch();
}

Is This Answer Correct ?    5 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain do array subscripts always start with zero?

751


Is it better to use a macro or a function?

644


Write a function expand(s1,s2) that expands shorthand notations like a-z in the string s1 into the equivalent complete list abc...xyz in s2 . Allow for letters of either case and digits, and be prepared to handle cases like a-b-c and a-z0-9 and -a-z. z-a:zyx......ba -1-6-:-123456- 1-9-1:123456789987654321 a-R-L:a-R...L a-b-c:abbc

5051


why we wont use '&' sing in aceesing the string using scanf

1775


What is the significance of scope resolution operator?

845






Can variables be declared anywhere in c?

612


What is the difference between constant pointer and constant variable?

740


What is the use of the function in c?

592


Are pointers really faster than arrays?

552


What is structure packing in c?

599


Explain the difference between call by value and call by reference in c language?

637


Write a program to print all permutations of a given string.

636


Why is event driven programming or procedural programming, better within specific scenario?

1947


Can we declare variables anywhere in c?

569


What is static function in c?

621