I think I am quite close. However, instead of replacing i with xy, my code just replaces i with x. I think the error is at line 38 strcpy.
However, is the logic correct from line 30 to 40? I am trying to say....

For each element in the first buffer(buf)
copy buf element into another buffer (temp) one character at a time
if buf element == 'i'
copy 'xy' to 'i'

2 Answers
2

you only have one increment of BufElement, but because your dest-buffer may be getting larger or smaller than the input, you should have two counters/pointers; one for the next place to write into your dest-buffer, and one which resembles the input-buffer.