Check out example codes for "free or delete in c++". It will help you in understanding the concepts better.

Code Example 1

delete --> If  you used the 'new' operator
free --> If you used 'malloc'

Learn ReactJs, React Native from akashmittal.com