Realloc fails after the 10th iteration inside a loop

后端 未结 2 339
感动是毒
感动是毒 2021-01-27 06:29

I\'m trying to get a sequence of letters from the user, and put the input inside a dynamic array.

However, from a reason I can\'t quite figure out - realloc fails (retu

2条回答
  •  无人及你
    2021-01-27 07:04

    You are writing to deallocated memory.

    memory_check is the newly reallocated pointer, you need to trade this value with first_string. first_string points to memory that has already now been freed (by realloc)

提交回复
热议问题