malloc, calloc and realloc can be used to allocate new memory. See below for detail usage and explanation
malloc() : allocates the specified number of bytes. malloc returns a void pointer (void *)
ex: Below statement allocates 10*4=40 bytes of memory at run time on heap.
int *ptr = (int *)malloc(10 * sizeof (int32_t));
calloc() : allocates the specified number of memory blocks of given size and initializes them to zero.
ex: Below statement allocates 10*4=40 bytes of memory at run time on heap and initializes to zero.
int *ptr = (int*)calloc(10, sizeof(int32_t));
realloc() : increases,decrease and allocates the size of the specified block of memory.
ptr is the pointer to a memory block previously allocated with malloc, calloc or realloc. if ptr is null then new block of memory is allocated.
4 is the new size for the memory block, in bytes.If it is 0 and ptr points to an existing block of memory, the memory block pointed by ptr is deallocated and a NULL pointer is returned
free() : releases the specified block of memory back to the system.