Dynamic Memory Allocation - tccicomputercoaching.com

Page 1

Dynamic Memory Allocation tccicomputercoaching.com The process of allocating memory during program execution is called dynamic memory allocation. DYNAMIC MEMORY ALLOCATION FUNCTIONS IN C: C language offers 4 dynamic memory allocation functions. They are, malloc () calloc () realloc () free ()

Syntax: 1. malloc () function is used to allocate space in memory during the execution of the program. malloc ()

malloc (number *sizeof(int));

2. calloc () function is also like malloc () function. But calloc () initializes the allocated memory to zero. calloc () 3. realloc ()

calloc (number, sizeof(int));


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.