Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

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
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

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top