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
What is difference between structure and union in c programming?
By using C language input a date into it and if it is right?
What is file in c preprocessor?
Explain what is a program flowchart and explain how does it help in writing a program?
Describe explain how arrays can be passed to a user defined function
the question is that what you have been doing all these periods (one year gap)
What are reserved words with a programming language?
How many identifiers are there in c?
What is ## preprocessor operator in c?
Do character constants represent numerical values?
Explain pointer. What are function pointers in C?
What do you mean by c?
What is wrong in this statement? scanf(“%d”,whatnumber);
What functions are in conio h?
int i=3; this declaration tells the C compiler to a) reserve space in memory to hold the integer value b) associate the name i with this memory location c) store the value 3 at this location d) all the above