Previous Page
Next Page

16.9. Dynamic Memory Management

Many programs, including those that work with dynamic data structures for example, depend on the ability to allocate and release blocks of memory at runtime. C programs can do that by means of the four dynamic memory management functions declared in the header stdlib.h, which are listed in Table 16-22. The use of these functions is described in detail in Chapter 12.

Table 16-22. Dynamic memory management functions

Purpose

Function

Allocate a block of memory

malloc( )

Allocate a memory block and fill it with null bytes

calloc( )

Resize an allocated memory block

realloc( )

Release a memory block

free( )



Previous Page
Next Page