Friday 7 June 2019

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 () calloc (number, sizeof(int));

3. realloc ()

realloc is used to update size of data.

realloc (pointer_name, number * sizeof(int));

4. free ()

free is used to release the memory allocated by malloc and calloc function.

free (pointer_name);

TCCI teach all programming concepts to the students in easiest way.

This basic knowledge will help students to learn advance programming concepts.

To enrol at TCCI.

Call us @ 9825618292

Visit us @ http://tccicomputercoaching.com/

No comments:

Post a Comment