PROGRAM FOR insertion in a STRING

2 replies [Last post]
amanhoney
Offline
Last seen: 10 years 11 weeks ago
Joined: 2010-01-08
bOt Points: 70

help me with the program gor insertion of a substring into a string .....

 

shashwat
Offline
Last seen: 1 year 31 weeks ago
Joined: 2009-02-18
bOt Points: 1160
Hi amanhoney, I have already

Hi amanhoney,

I have already replied to this here - http://www.botskool.com/forum/computer-programming/c/c-programming/plz-h...

Founder and Admin

nitesh
Offline
Last seen: 9 years 35 weeks ago
Joined: 2009-03-26
bOt Points: 370
insert substring

the logic is pretty simple

1.

starting from the last character shift the original string ahead by a number equal to length of substring. something like

str[i+strlen(substr)]= str[i]

2.

continue this till you get to the position where u want to insert the substring.

3.

Copy the substring

 

try this and post your code if you are unable to complete it