Go Back   Cloud Computing > General Discussion > General Discussion Forum
 

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 01-29-07, 02:20
BOD Member
 
Join Date: Jan 2007
Posts: 66
Default malloc(),calloc() and realloc() functions?

Is there anyone who could explain about malloc(),calloc() and realloc() functions? Thank you so very much!
:rolleyes: :rolleyes: :rolleyes:
Reply With Quote
  #2 (permalink)  
Old 01-29-07, 03:27
BOD Member
 
Join Date: Jan 2007
Posts: 39
Default

well malloc() is for dynamic allocation of memory in C.

Functions: these allocate a space of memory for a pointer variable but here are some difference between them - one just hold the space on HEAP for the variable, one initialize that space with null value, and one hold another memory zone for the same variable.

Good luck with your C programming! :D
Reply With Quote
  #3 (permalink)  
Old 01-29-07, 04:16
BOD Member
 
Join Date: Nov 2005
Location: Lancashire, UK
Posts: 82
Default

malloc is dynamic memory allocation,it allocates the memory and initialize garbage value.

calloc is similar to malloc but only difference is initialize zero
realloc() changes the size of the memory block pointed to by ptr to size bytes.
Reply With Quote
  #4 (permalink)  
Old 01-29-07, 04:24
BOD Member
 
Join Date: Dec 2006
Posts: 81
Default

malloc() is a standard library function used in C programming language for performing dynamic memory allocations.

calloc() is function is related to malloc. When malloc() returns a memory block to the programmer for use, it is uninitialized. calloc() function allocates the memory and initilise it.

realloc() function is used to make a block of memory which can be same in content and aldo be copied.
Reply With Quote
  #5 (permalink)  
Old 01-29-07, 23:06
BOD Member
 
Join Date: Jan 2007
Posts: 66
Default

thank you so much for all your answer... you guys are so great and helpful!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump


All times are GMT -6. The time now is 14:58.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
Copyright © 1999-2012, BODHost Ltd. All rights reserved.