Calloc in C Language

No comments


Calloc ( ) : Calloc ( ) is another memory allocation function that is normally used for requesting memory space at run time for storing derived data types such as arrays and structures. While malloc allocates a single blog of storage place, calloc allocates multiple blocks of storage, each of the same size and then sets all bytes to zero.

General Form :

ptr = (cast_type *)calloc(n = elen_size);
The above statement allocates contiguous space for n blocks, each of size elen_size bytes. All bytes are initialize  to zero and a pointer to the first byte of the allocated resin is returned. If there is not enough space, a null pointer is return.

No comments :

Post a Comment

Subscribe

Milan Panda
Admin
About Me | Contact
Copyright 2023-2024 © Programming1011 . 🎀 Developed and Design By- Milan Panda. Happy Holi All Of You 🎀