uses of Calloc over malloc in embedded system

Status
Not open for further replies.

bagavathi

Member level 3
Joined
Nov 15, 2011
Messages
58
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Location
Tamil Nadu,India
Visit site
Activity points
1,686
hi friendz,

I know calloc means the allocated memory is intilized to zero but what is the uses of Calloc over malloc in embedded system and where it is used?? if use calloc, is it reduce the speed?
 

In a place If you want a variables to be allocated and initialized....

For example, If you want a buffer you will just use malloc.
But if you want a buffer initialized and all of its values 0 then you have to use malloc followed by memset, To avoid just you can use a calloc..

Talking about the program memory If you want to reduce the sizze then use less functions that means, In a program if you already used malloc then Its better using malloc memset, or use calloc in both places but using malloc and calloc in two places will increase the code size because it uses two inbuilt functions.......
 
Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…