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


Please Help Members By Posting Answers For Below Questions

How to draw the flowchart for structure programs?

8758


What is a buffer in c?

568


What's the total generic pointer type?

608


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);

640


What does do in c?

601






What is equivalent to ++i+++j?

640


largest Of three Number using without if condition?

996


Can we add pointers together?

612


In the DOS enveronment, normal RAM that resides beyond the 1mb mark. a) expanded memory b) swapped memory c) Extended memory d) none

712


What is array within structure?

578


What is type qualifiers?

653


What is character constants?

708


Whats s or c mean?

591


the 'sizeof' operator reported a larger size than the calculated size for a structure type. What could be the reason?

559


What is a structure and why it is used?

614