From: deo sharma [mailto:[EMAIL PROTECTED] 

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

Because you want to initialise it to a different value, and having it
initialised twice is pointless?

int i;
void* DefaultValue = (void*)main;
void* pPtrArray = malloc(10*sizeof(*pPtrArray));
for(i=0; i<10; ++i)
   pPtrArray[i] = DefaultValue;

What gain does calloc() give you in this instance?

Can you give any good reason why having it filled with 'all bits zero'
when this isn't necessarily the 'Null Pointer' (with the associated
extra overhead involved) is any better than gettting randomly filled
memory with no overhead?

--
PJH

bug, n: An elusive creature living in a program that makes it incorrect.
The activity of "debugging", or removing bugs from a program, ends when
people get tired of doing it, not when the bugs are removed. -
"Datamation", January 15, 1984 






Alderley plc, Arnolds Field Estate, The Downs, Wickwar, Gloucestershire, GL12 
8JD, UK
Tel: +44(0)1454 294556 Fax: +44 (0)1454 299272

Website : www.alderley.com  Sales : [EMAIL PROTECTED] Service : [EMAIL 
PROTECTED]

This email and its contents are confidential and are solely for the use of the 
intended recipient. If you are not the original recipient you have received it 
in error and any use, dissemination, forwarding, printing or copying of this 
email is strictly prohibited. Should you receive this email in error please 
immediately notify [EMAIL PROTECTED]

This email has been scanned for viruses, however you should always scan emails 
with your own systems prior to opening.









------------------------ Yahoo! Groups Sponsor --------------------~--> 
$4.98 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/Q7_YsB/neXJAA/yQLSAA/EbFolB/TM
--------------------------------------------------------------------~-> 

To unsubscribe : [EMAIL PROTECTED]

 
Yahoo! Groups Links

<*> To reply to this message, go to:
    
http://groups.yahoo.com/group/Programmers-Town/post?act=reply&messageNum=4908
    Please do not reply to this message via email. More information here:
    http://help.yahoo.com/help/us/groups/messages/messages-23.html

<*> 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:
    http://docs.yahoo.com/info/terms/
 



Reply via email to