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
Is file a keyword in c?
What is a protocol in c?
Is r written in c?
What is the difference between test design and test case design?
please can any one suggest me best useful video tutorials on c i am science graduate.please help me.u can email me to sas29@in.com
Explain how are portions of a program disabled in demo versions?
How do you define a string?
Write a program on swapping (100, 50)
What is union and structure?
What is #define used for in c?
Why can’t constant values be used to define an array’s initial size?
When should the const modifier be used?
What is the general form of #line preprocessor?
Why c is called a mid level programming language?
What are extern variables in c?