What would realloc do if there is no sequential space of memory?

后端 未结 5 1607
一向
一向 2020-12-31 10:30

realloc is used to reallocate the memory dynamically.

Suppose I have allocated 7 bytes using the malloc function and now I want to extend i

5条回答
  •  Happy的楠姐
    2020-12-31 11:17

    realloc will only succeed if it can return a contiguous ("sequential" in your words) block of memory. If no such block exists, it will return NULL.

提交回复
热议问题