Académique Documents
Professionnel Documents
Culture Documents
com/)
CLANGUAGE
"Cismostwidelyusedgeneralpurposelanguagetodayinoperatingsystems,andembedded
systemdevelopment."
SEETHEINDEX
Description
malloc()
allocatesrequestedsizeofbytesandreturnsavoidpointerpointingtothefirstbyteofthe
allocatedspace
calloc()
allocatesspaceforanarrayofelements,initializethemtozeroandthenreturnavoidpointerto
thememory
free
releasespreviouslyallocatedmemory
realloc
modifythesizeofpreviouslyallocatedspace
int*x;
x=(int*)malloc(50*sizeof(int));
x=(int*)realloc(x,100);//allocatedanewmemorytovariablex
malloc()
calloc()initializestheallocatedmemorywith0
value.
malloc()initializestheallocatedmemorywithgarbage
values.
Numberofargumentsis2
Numberofargumentis1
Syntax:
Syntax:
(cast_type*)calloc(blocks,size_of_block)
(cast_type*)malloc(Size_in_bytes)
Prev(errorhandlinginc.php)
Next(commandlineargument.php)
HandcraftedwithLove
AboutUs(http://www.studytonight.com/about)Suggest(http://www.studytonight.com/suggest)Terms
(http://www.studytonight.com/terms)ContactUs(http://www.studytonight.com/contact)Collaborate
(http://www.studytonight.com/collaborate/)Authors(http://www.studytonight.com/authors/)Blog
(http://studytonight.tumblr.com/)