Check out example codes for "Dynamically allocate a string object and save the address in the pointer variable p.". It will help you in understanding the concepts better.

Code Example 1

#include <iostream>

int main()
{
string* p;
int n;

p = new string; // Dynamically allocate a string object and save the address in the pointer variable p.

}

Learn ReactJs, React Native from akashmittal.com