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
Difference between pass by reference and pass by value?
What is volatile, register definition in C
Is c is a middle level language?
What is a loop?
GIven a sequence of characters. How will you convert the lower case characters to upper case characters. ( Try using bit vector - sol given in the C lib -> typec.h)
Is c is a low level language?
What are identifiers and keywords in c?
What is meant by errors and debugging?
An instruction which is analysed and acted upon by the processor prior to the compiler going its work a) directive b) constructive c) constant d) absolute mode
Is malloc memset faster than calloc?
How do you convert strings to numbers in C?
Is c# a good language?
What is the scope of global variable in c?
Explain do array subscripts always start with zero?
Is it valid to address one element beyond the end of an array?