Kapil <[EMAIL PROTECTED]> wrote:
deo sharma wrote:
> the question still remains that why we need a malloc when calooc will
> don the same thing by inistialising the memory with zero rther than some
> random value.
>
there are circumstances when zeroing out allocated memory is not
required, so malloc is used. and these circumstances are when the
allocated memory will be stuffed wil data as soon as it is allocated. So there is no need to zero out everything and waste memory cyclesAlso, note that calloc() is just ALL BITS ZERO. Its *NOT* the same as the "zero initialized" global variables (i.e, a global floating point number or a global pointer getting initialized to "zero" is always correct as per the internal representations (which need not always be all-bits-zero)).
Kapil
Yahoo! India Matrimony: Find your life partner
online.
To unsubscribe : [EMAIL PROTECTED]
| Yahoo! Groups Sponsor | |
|
|
Yahoo! Groups Links
- To reply to this message, go to:
http://groups.yahoo.com/group/Programmers-Town/post?act=reply&messageNum=4832
Please do not reply to this message via email. (more info)
- To visit your group on the web, go to:
http://groups.yahoo.com/group/Programmers-Town/
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
