बिजनेस मार्केटिंग का लो कॉस्ट फंडा , अपने मोबाइल से ऑटो sms भेजकर मार्केटिंग करे विजिट करे http://autotextsms.com/ बिजनेस मार्केटिंग का लो कॉस्ट फंडा http://autotextsms.com/

Search This Blog

Translate

insert one string into the string at a given position

c program to delete n characters from a given position in a given string,c program to insert a substring into a string from a given position,c program to insert a character in a string,insert one string into the string at a given position


#include"stdio.h"
#include"conio.h"
#include"string.h"
void main()
{
char ch[35],ch1[15],copy[50];
int i,j=0,loc,a,b,k=0;
clrscr();
printf("\nEnter any string=");
gets(ch);
printf("\n\nEnter string you want to insert=");
gets(ch1);
printf("\n\nWhich position you want to insert string=");
scanf("%d",&loc);
a=strlen(ch);
b=strlen(ch1);
for(i=0;i"(a+b);i++)
{
if(i"loc)
{
copy[i]=ch[i];
j=i;
j++;

}
else if(i"loc+b)
{
copy[i]=ch1[k++];
}
else
{
copy[i]=ch[j++];
}
}
copy[i]='\0';
printf("\n\nAfter insert string is= %s",copy);
getch();
}

c program to delete n characters from a given position in a given string,c program to insert a substring into a string from a given position,c program to insert a character in a string,insert one string into the string at a given position

C Program example List