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



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

Answer / 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

More C Interview Questions

Explain the use of keyword 'register' with respect to variables.

0 Answers  


how can i make a program with this kind of output.. Enter a number: 5 0 01 012 0123 01234 012345 01234 0123 012 01 0

4 Answers   Wipro,


Is an array parameter is always "by reference" ?

1 Answers  


Explain how can you be sure that a program follows the ansi c standard?

0 Answers  


What are identifiers c?

0 Answers  


How can you pass an array to a function by value?

0 Answers  


what is the output of the code and how? main() { int *ptr,x; x=sizeof(ptr); printf("%d",x); }

1 Answers  


f(*p) { p=(char *)malloc(6); p="hello"; return; } main() { char *p="bye"; f(p); printf("%s",p); } what is the o/p?

7 Answers   Hughes,


List a few unconditional control statement in c.

0 Answers  


A woman had somany gloves and hats 22 red,34 blue, 45 white...there was power cut and she took a glove and how many gloves shud she take so that she gets a pair of glove fr each color??

3 Answers   TCS,


main() { int i=0; while(+(+i--)!=0) i-=i++; printf("%d",i); }

4 Answers  


What is spark map function?

0 Answers  


Categories