Dynamic Memory Allocation :: free(3)

Dynamic Memory Allocation :: free(3)

  • Now that we can malloc, calloc, and realloc we need to be able to free the memory space if we have no use for it anymore. Like we mentioned above, any memory space that loses its pointer or isn't free'd is a memory leak.
  • So what's the prototype for free(3)? Here it is:
      void free(void *ptr);
    free simply takes in a pointer to free. Not challenging at all. Note that free can take in NULL, as specified by ANSI.

Post a Comment

Please Select Embedded Mode To Show The Comment System.*

Previous Post Next Post