Dynamic Memory Allocation Quiz

Placewit
Aug 18, 2021

--

What is the return type of malloc() or calloc() ?

A. void *

B. Pointer of allocated memory type

C. void **

D. int *

Solution :

The C library function void *calloc(size_t nitems, size_t size) allocates the requested memory and returns a pointer to it just like the void *malloc(size_t size) The difference in malloc and calloc is that malloc does not set the memory to zero where as calloc sets allocated memory to zero. Both return void*, which is a generic pointer that can point to any type of data

Thanks for Reading

Placewit grows the best engineers by providing an interactive classroom experience and by helping them develop their skills and get placed in amazing companies.

Learn more at Placewit. Follow us on Instagram and Facebook for daily learning.

--

--

Placewit
Placewit

Written by Placewit

Upskilling students for tech placements!

No responses yet