Calloc in C Language
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.
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment