C – Dynamic memory allocation

Prev     Next Dynamic memory allocation in C: 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() Function Syntax malloc () malloc (number *sizeof(int)); calloc () calloc (number, sizeof(int)); realloc () realloc (pointer_name, number * sizeof(int)); free () free (pointer_name); 1. malloc() function in C: malloc () function is used to allocate space in memory during the execution of the program. malloc () does not initialize the memory allocated during execution.  It carries garbage value. malloc … Continue reading C – Dynamic memory allocation