malloc returns a void pointer to the allocated space, or NULL if there is insufficient memory available and use a type cast on the return value. The storage space pointed to by the return value is guaranteed to be suitably aligned for storage of any type of object in the heap and returns a valid pointer to that item.
Originally Posted by MSDN
calloc calls malloc in order to use the C++ _set_new_mode function to set the new handler mode. The new handler mode indicates whether, on failure, malloc is to call the new handler routine as set by _set_new_handler. By default, malloc does not call the new handler routine on failure to allocate memory. You can override this default behavior so that, when calloc fails to allocate memory, malloc calls the new handler routine in the same way that the new operator does when it fails for the same reason. To override the default, call