Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

Why doesnt that code work?

1188


What is difference between structure and union?

1134


How do we open a binary file in Read/Write mode in C?

1242


If you know then define #pragma?

1111


What are types of functions?

1044


Tell us something about keyword 'auto'.

1074


How can I remove the leading spaces from a string?

1172


‎How to define structures? · ‎

1091


write a program to rearrange the array such way that all even elements should come first and next come odd

2281


Can we access the array using a pointer in c language?

1051


Explain Function Pointer?

1183


What is the best way to comment out a section of code that contains comments?

1346


What is the c value paradox and how is it explained?

1062


what are the program that using a two dimensional array that list the odd numbers and even numbers separately in a given 10 inputs values

1701


Describe explain how arrays can be passed to a user defined function

1109