What is calloc ? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 1

What is calloc ?

16th Dec 2019, 3:47 PM
Shreyas Chimote
Shreyas Chimote - avatar
3 Respostas
+ 2
Calloc is a function! D It's declaration is: void *calloc(size_t nitems, size_t size); First argument is the number of items you need and second is the size of each item. It allocates memory for these items and initialize it's values to null and that is the main difference between calloc and malloc
16th Dec 2019, 3:54 PM
Lighton
Lighton - avatar
+ 1
Thanks bro Lighton
16th Dec 2019, 4:36 PM
Shreyas Chimote
Shreyas Chimote - avatar
+ 1
It stands for contagious allocation . It is used under the header file stdio.h . It stores the memory dynamically It allocates multiple blocks of storage each of same size and sets all bytes to 0. It is generally used for storing arrays.
17th Dec 2019, 4:03 AM
Ayush Khandelwal
Ayush Khandelwal - avatar