How does realloc() reallocate the memory?
问题 How does realloc() reallocate the memory which was first allocated by malloc() ? I know that you need to use malloc() before you´re able to reallocate the memory, but I don´t understand how that really should work. What if a dynamic-memory object gets decreased in size by realloc() ? Is this respective piece of the object just erased after the call to realloc() ? My Question is: How does the realloc() function reallocate a dynamic-memory object created by malloc() ? Note: I did this Q&A