Introduction

The free() function releases the allocated memory, making it available for malloc() or something else to use.

Demo

#include <stdio.h> 
#include <stdlib.h> 

int main() /* w w w.ja  v a2s . co  m*/
{ 
    int *age; 

    age = (int *)malloc(sizeof(int)*1); 
    if(age==NULL) 
    { 
        puts("Out of Memory or something!"); 
        exit(1); 
    } 
    printf("How old are you in years? "); 
    scanf("%d",age); 
    *age *= 365; 
    printf("You're over %d days old!\n",*age); 
    free(age); 

    return(0); 
}

Result

Related Topic