write a program to insert an element at the specified
position in the given array in c language
Answer Posted / ashok kannan
Hi to all,
/* program to insert element in the array at given
position*/
#include<stdio.h>
#include<conio.h>
void main()
{
char c,t2,t1,a[100]="This is c program";
int n,i;
printf("Enter the position and the element\n");
scanf("%d%c",&n,c);
for(i=n,t1=a[i];a[i]!='\0';i++)
{
t2=a[i+1];
a[i+1]=t1;
t1=t2;
}
a[n]=c;
printf("%s",a);
getch();
}
Is This Answer Correct ? | 19 Yes | 46 No |
Post New Answer View All Answers
How to draw the flowchart for structure programs?
What is a buffer in c?
What's the total generic pointer type?
a=10;b= 5;c=3;d=3; if(a printf(%d %d %d %d a,b,c,d) else printf("%d %d %d %d a,b,c,d);
What does do in c?
What is equivalent to ++i+++j?
largest Of three Number using without if condition?
Can we add pointers together?
In the DOS enveronment, normal RAM that resides beyond the 1mb mark. a) expanded memory b) swapped memory c) Extended memory d) none
What is array within structure?
What is type qualifiers?
What is character constants?
Whats s or c mean?
the 'sizeof' operator reported a larger size than the calculated size for a structure type. What could be the reason?
What is a structure and why it is used?