Dynamically allocate a string object and save the address in the pointer variable p. code example
Example: Dynamically allocate a string object and save the address in the pointer variable p.
#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.
}