Dynamic Memory Allocation in C Programming

 Dynamic allocation is a unique feature to C. It enables us to create data types and structures of any size and length to suit our programs need within the program. We use dynamic memory allocation concept when we don't know how in advance about memory requirement.
There are following functions to use for dynamic memory manipulation:
  • void *calloc(size_t num elems, size_t elem_size) - Allocate an array and initialise all elements to zero .
  • void free(void *mem address) - Free a block of memory.
  • void *malloc(size_t num bytes) - Allocate a block of memory.
  • void *realloc(void *mem address, size_t newsize) - Reallocate (adjust size) a block of memory.
www.cinterviews.com appreciates your contribution please mail us the questions you have to cinterviews.blogspot.com@gmail.com so that it will be useful to our job search community

No comments:

 
Top Blogs