Check out example codes for "c++ delet from memory". It will help you in understanding the concepts better.

Code Example 1

// Delete pointer
int* ptr1 = new int;
delete ptr1;

// Delete array
int* array = new int[10];
delete[] array;

Learn ReactJs, React Native from akashmittal.com