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 what is the difference between a string copy (strcpy) and a memory copy (memcpy)? When should each be used?

0 Answers  


what is the use of keyword volatile??

4 Answers   LG Soft,


main() {int i=5; // line 1 i=(++i)/(i++); // line 2 printf("%d",i); // line 3 } output is 2 but if we replace line 2 and line 3 by printf("%d",i=(++i)/(i++)); then output is 1. Why?

1 Answers   GATE,


Suppose we have a table name EMP as below. We want to perform a operation in which, I want to change name ‘SMITH’ from as ‘SMITH JAIN’. Also I want to change the name of the column from ENAME to E_NAME. EMPNO ENAME JOB MGR HIREDATE SAL 7369 SMITH Coder 7902 17-DEC-80 800 7499 ALLEN SALESMAN 7698 20-FEB-81 1600 7521 WARD SALESMAN 7698 22-FEB-81 1250

0 Answers  


Is there any data type in c with variable size?

0 Answers  






a 'c' program to tell that the set of three coordinates lie on a same line

3 Answers   Persistent,


consider the following structure: struct num nam{ int no; char name[25]; }; struct num nam n1[]={{12,"Fred"},{15,"Martin"},{8,"Peter"},{11,Nicholas"}}; ..... ..... printf("%d%d",n1[2],no,(*(n1 + 2),no) + 1); What does the above statement print? a.8,9 b.9,9 c.8,8 d.8,unpredictable value

4 Answers   TCS,


Why can’t we compare structures?

0 Answers  


can i know the source code for reversing a linked list with out using a temporary variable?

6 Answers   Honeywell,


How do you initialize pointer variables?

0 Answers  


write a programming in c language, 1 3 5 7 9 11

2 Answers   NIIT,


hello everybody can we change a the adress of a variabl i mean can i put for exemple for a int *p: &p=6 ?????????

1 Answers  


Categories