Difference BW malloc() and calloc() and realloc()
Difference BW malloc() and calloc() and realloc()
- malloc function allocates a specified number of bytes of memory. The initial value of the memory is indeterminate.
- calloc funtion allocates space for a specified number of objects of a specified size. The space is initialized to all 0 bits.
- realloc function increases or decreases the size of a previously allocated area. When the size increases, it may involve moving the previously allocated area somewhere else, to provide the additional room at the end. Also, when the size increases, the initial value of the space between the old contents and the end of the new area is indeterminate.