Check out example codes for "how to free memory in c". It will help you in understanding the concepts better.

Code Example 1

ptr = (cast-type*) malloc(byte-size)

Code Example 2

int *example = NULL; //create pointer
example = malloc(sizeof(int)); //allocate memory
free(example); //deallocate memory

Learn ReactJs, React Native from akashmittal.com