Dynamic memory allocation in C

(Team) #1

C language requires the number of elements in an array to be specified at compile time. But we may not be able to do so always. Our initial judgement of size, if it is wrong, may cause failure of the program or wastage of memory space. The process of allocating memory at run time is known as dynamic memory allocation. Although C does not inherently have this facility, there are four librar routines known as "memory managment functions" that can be used for allocating and freeing memory during program execution. They are listed in table below. These functions help us build complex application programs that use the available memory intelligently.

Read this article to understand Dynamic memory allocation in C in depth

Have a doubt or thought? Join the discussion now

This is a companion discussion topic for the original entry at http://iq.opengenus.org/dynamic-memory-allocation-c/