Deallocate dynamically allocated memory: how to use free : Memory Free « Memory « C / ANSI-C






Deallocate dynamically allocated memory: how to use free



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

int main ()
{
  int *buffer1, *buffer2, *buffer3;

  buffer1 = (int*) malloc (10*sizeof(int));
  buffer2 = (int*) calloc (10,sizeof(int));
  buffer3 = (int*) realloc (buffer2,50*sizeof(int));
  
  
  free (buffer1);
  free (buffer3);
  return 0;
}

           
       








Related examples in the same category