Check out example codes for "c++ dynamic memory allocation exercises". It will help you in understanding the concepts better.

Code Example 1

#include <iostream>

int main()
{
	int *ptr = new int;
	*ptr = 4;
	std::cout << *ptr << std::endl;
	return 0;
}

Learn ReactJs, React Native from akashmittal.com