diff b/w malloc() and calloc()

2 replies [Last post]
dhanunjaya
Offline
Last seen: 9 years 32 weeks ago
Joined: 2009-04-26
bOt Points: 153

What are the differences between malloc() and calloc()?

preeti
Offline
Last seen: 10 years 14 weeks ago
Joined: 2009-03-30
bOt Points: 85
Difference b/w malloc() n calloc()

malloc() is used to allocate memory to one unit of any data type

 

 

 

whereas

 

 

calloc() is used to allocate 'n' units of any data type!

shotgun
Offline
Last seen: 10 years 21 weeks ago
Joined: 2009-03-20
bOt Points: 122
SYNTAX!!

They Both allocates memory dynamically!!

 

SYNTAX!!

 

void *malloc (Size);

 

 

void *calloc (NumberOfElements, ElementSize) ;