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
Explain do array subscripts always start with zero?
Is it better to use a macro or a function?
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
why we wont use '&' sing in aceesing the string using scanf
What is the significance of scope resolution operator?
Can variables be declared anywhere in c?
What is the difference between constant pointer and constant variable?
What is the use of the function in c?
Are pointers really faster than arrays?
What is structure packing in c?
Explain the difference between call by value and call by reference in c language?
Write a program to print all permutations of a given string.
Why is event driven programming or procedural programming, better within specific scenario?
Can we declare variables anywhere in c?
What is static function in c?