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

后端 未结 5 1631
一向
一向 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条回答
  •  余生分开走
    2020-12-31 11:13

    FreeBSD and Mac OS X have the reallocf() function that will free the passed pointer when the requested memory cannot be allocated (see man realloc).

提交回复
热议问题