What is malloc in c language? | SoloLearn: Learn to code for FREE!


What is malloc in c language?

8/31/2019 10:42:14 AM

Swami Swami

4 Answers

New Answer


Malloc : void *malloc(size_t n) ; This function is used in dynamic memory allocation. It allocates memory from the heap. We can only access the part of allocated memory through a pointer. E.g : int *i = malloc(sizeof(int)) ; *i = 10; free(i);


Here; https://www.geeksforgeeks.org/dynamic-memory-allocation-in-c-using-malloc-calloc-free-and-realloc/


malloc is used to allocate the memory dynamically


Can you explain?