Good job!
This is all wrong though:
Code:
int *arrayPtr[4]; //OK
int *my_array[4]={1,2,3,4};
//ERROR You have an array with 4 pointers, and their names are my_array[0], my_array[1],
//my_array[2], and my_array[3]. You have to assign the address of an int to each of
//those pointers. The values in the intializer list: {1,2,3,4} are not addresses of int's.
array[0]=&my_array[0]; //You haven't declared a variable named 'array'
cout <<*array[0]<<endl; // everything is ok. I got it
//How is that possible? Your code gives me 9 errors.
Finally, you have to decide if that is the best way to write the code. It really doesn't make sense to have two arrays. If you have studied using the new operator to dynamically allocate memory, I think Daved is suggesting something like this:
Code:
infile >> word;
pointers[i]= new string(word);
That calls the version of the string constructor that takes another string object as a parameter, and then assigns the address to the pointer.