Seo Forum

Coding & Programming => Programming Forum => Topic started by: chinmay.sahoo on 03-04-2016, 03:59:57

Title: What is the difference between malloc() and calloc()?
Post by: chinmay.sahoo on 03-04-2016, 03:59:57
The two functions mainly is to allocate memory and they are commonly called as memory managers.
     Malloc()  :- Malloc function take one argument
     Calloc()  :- Calloc function take two argument in a time. The bits in the allocated space are initialized to zero.
Title: Re: What is the difference between malloc() and calloc()?
Post by: TomClarke on 04-19-2016, 05:42:01
Both malloc ans calloc are used in C language for dynamic memory allocation they obtain blocks of memory dynamically.
But there are two main differences between malloc and calloc in C programming language;
- the number of arguments. The malloc takes a single argument and calloc takes two.
- malloc does not initialize the memory allocated and calloc initializes the allocated memory to 0.