write a program to insert an element at the specified
position in the given array in c language
Answer Posted / koshy
#include "stdio.h"
main()
{
char str="hello world";
char i,j,a,b,len;
len=((const char *)str);
printf("char to be inserted:");
scanf("%d",&a);
printf("at position");
scanf("%d",&b);
for(i=0;i<len;i++)
{
temp=str[b];
str[b]=a;
str[b+1]=temp;
for(j=b+1;(j<len) &&(str[j]!=0);j++)
{
str[j+1]=str[j];
}
}
}
| Is This Answer Correct ? | 19 Yes | 14 No |
Post New Answer View All Answers
How do you redirect a standard stream?
What is hash table in c?
code for find determinent of amatrix
Is c pass by value or reference?
#include main() { int *p, *c, i; i = 5; p = (int*) (malloc(sizeof(i))); printf(" %d",*p); *p = 10; printf(" %d %d",i,*p); c = (int*) calloc(2); printf(" %d ",*c); }
Are global variables static in c?
What is structure in c definition?
When should volatile modifier be used?
What is memcpy() function?
How can I do peek and poke in c?
What is the use of printf() and scanf() functions?
Is null always defined as 0(zero)?
Is c object oriented?
Write a program to generate the Fibinocci Series
What is void main ()?