// This program illustrates dynamic allocation of storage for C-strings. #include using namespace std; int main() { const int NAME_LENGTH = 50; // Maximum length char *pname; // Address of array // Allocate the array. pname = new char[NAME_LENGTH]; // Read a string. cout << "Enter your name: "; cin.getline(pname, NAME_LENGTH); // Display the string. cout << endl << "Hello " << pname << endl; return 0; }