ProAnswers.org

difference between malloc() and calloc()?

1 Like

malloc() takes a single argument (memory required in bytes), while calloc() takes two arguments (number of variables to allocate memory, size in bytes of a single variable).

malloc() does not initialize the allocated memory, while calloc() initializes the allocated memory to 0 (zero).

malloc() allocates byte of memory, whereas calloc() allocates block of memory.