How to use free() function?

How to use free() function?

Free() function is used to return the memory to the operating system after use.Because is most of time very limited source.So,we have to try to made max output.
Example:
#include 
#include 
int main ()
{
   int *R1, *R2, *R3;
   R1 = (int*) malloc (10*sizeof(int));
   R2 = (int*) calloc (10,sizeof(int));
   R3 = (int*) realloc (R2,50*sizeof(int));
   free (R1);
   free (R3);
   return 0;
}  

By:Vivek Kr. Agarwal
Date:2007-01-09 00:00:00

Post Your Answers


User Email:

User Name:
Answers:

Related C Subjective Links

C Subjective interview questions and answers for experienced and fresher