What is malloc in c language? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is malloc in c language?

31st Aug 2019, 10:42 AM
Swami Swami
Swami Swami - avatar
4 Answers
+ 2
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);
31st Aug 2019, 10:56 AM
Théophile
Théophile - avatar
+ 1
malloc is used to allocate the memory dynamically
31st Aug 2019, 10:58 AM
👀 Sandy👀
👀  Sandy👀 - avatar
0
Can you explain?
31st Aug 2019, 10:43 AM
Swami Swami
Swami Swami - avatar