#include <iostream>

using namespace std;

/* Dynamically allocates space for a number of words known only at runtime. */

char * makeOneString();
int main(){

    int size;

    cout << "Enter a number of words: " << endl;
    cin >> size;

    /* Draw what is happening in memory so you can see why this type is needed. */
    char **strings = new char*[size];

    for(int i = 0; i < size; i++)
	strings[i] = makeOneString();

    for(int i = 0; i < size; i++)
	cout << endl << strings[i];
    cout << endl;

    return 0;
}


char * makeOneString(){

    int size;
    char temp[30];

    cout << "Enter a string: ";
    cin >> temp;

    size = 1 + strlen(temp);

    char *s = new char[size];

    strcpy(s, temp);

    //cout << endl << s << " " << size;
    //cout << endl;

    return s;
}

