Memory Allocation in C

The process of allocating memory during program execution is called dynamic memory allocation.the following table are displaying function taht used in dynamic memory allocation in c programming.

Sr.No

Functions

Descriptions

01

malloc

Allocates request size of bytes and returns a pointer to the first byte of the allocated space.

02

calloc

Allocates space for an array of elements,initializes them to zero and then returns a pointer to the memory.

03

free

Frees previously allocated space.

04

realloc

Modifies the size of previously allocated space.

Example Using Malloc


int *x;
x = (int*)malloc(50 * sizeof(int));
free(x);  							
							
Share Share on Facebook Share on Twitter Share on LinkedIn Pin on Pinterest Share on Stumbleupon Share on Tumblr Share on Reddit Share on Diggit

You may also like this!