C – Memory Allocation

Memory Allocation

  • Static Memory allocation
    • In case of static memory allocation, memory is allocated at compile time and memory can’t be increased while executing the program. It is used in array
  •  Dynamic memory allocation
    • In case of dynamic memory allocation, memory is allocated at run time and memory can be increased while executing the program. It is used in linked list.
    • The following functions are used in Dynamic memory allocation
      • malloc()    –    allocates single block of requested memory. It has garbage value initially.
      • calloc()     –    allocates multiple block of requested memory. It initially initializes all bytes to zero.
      • realloc()    –    reallocates the memory occupied by malloc()  or calloc()  functions.
      • free()         –    frees the dynamically allocated memory.

Difference b/w Static and dynamic memory allocation?

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

if you have any queries call us +918300026060 or WhatsApp Dismiss

0

Your Cart

%d bloggers like this: