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 cycles

Also, 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
ADVERTISEMENT
click here


Yahoo! Groups Links

Reply via email to