阅读背景:

如何使用realloc()在动态目标中插入字符串?

来源:互联网 

I'm struggling with memory allocation. I wanted to input a string into another and I made two functions that stop working at the same place - realloc. These functions are very similar. In first one I copy char by char into a temporary string and when I try to copy temporary string to the first one is the place where I get errors. In the second function I copy the end of first string (from the given position) to a temporary string, reallocate the first string (this is where I get errors) and remove everything in i from the given position. Then I append second string and temporary to a first string. Here is my code. First function:I'm struggling with memory allocation. I wanted




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: