C/Memory/Memory Free
Deallocate dynamically allocated memory: how to use free
<source lang="cpp">
- 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;
}
</source>