April 2021
Intermediate to advanced
539 pages
10h 44m
English
Keeping track of when memory should be freed, so we always remember to do it and never call free() on the same memory twice, is at times complicated. The scenario where you have a function that allocates some memory, uses it, and then frees it before the function returns is hardly ever problematic. If you have many exit points, that is, you return multiple places, you must ensure that you free everything regardless of how you exit the function, but unless it is an incredibly complicated function, it is manageable. However, once you start working with heap-allocated data ...
Read now
Unlock full access