title: How to use a pointer to an array of strings?
body: <p>My homework problem is to modify code written for a previous assignment that saved an array (of user-specified size) of test scores so that it also saves a parallel array of student names associated with these test scores. We are to use pointers and pointer notation whenever possible. </p>
  
  <p>My problem occurs early on: I ask for the student's full name and receive the input using the getline cin object and cin.ignore() to avoid passing the last name into my next cout/cin request.</p>
  
  <p>However, when I attempt to recall the student name using either pointer notation (deref the pointer) or array notation all I get is blank space. String objects have been the most difficult for me to grasp this quarter, so it is possible that it is just that I am missing a crucial bit of reasoning here. I have gone back and read through my text but it is not incredibly helpful as it shows my exact format for a similar desired result. Also, most online research has been yielding info that is well beyond a first quarter c++ student like myself. Any help is very much appreciated! Here is the snippet of code where I think my problem lies:</p>
  
  <pre><code>#include&lt;iostream&gt;
  #include&lt;cmath&gt;
  #include&lt;iomanip&gt;
  #include&lt;string&gt;
  using namespace std;
  
  void sortArray(int*, string*, int);
  void averageScore(int*, int);
  
  
  
  int main()
  {
      //pointer to point to test scores
      int* scores; 
      string* student;
      // integer test to indicate size of array
      int test;
  
      // get user defined array size
      cout &lt;&lt; "How many tests would you like to save?" &lt;&lt; endl;
      cin &gt;&gt; test;
  
      // define dynamically allocated array scores
      scores = new int[test];
      student = new string[test];
  
      // for loop to enter each test score as an element of scores array
      for (int i = 0; i &lt; test; i++)
      {
          cout &lt;&lt; "Enter the student's name: " &lt;&lt; endl;
          getline(cin, student[i]);
          cin.ignore();
  
  
          cout &lt;&lt; "Enter the test score for " &lt;&lt; *(student+i) &lt;&lt; " : "&lt;&lt; endl;
          cin &gt;&gt; *(scores+i);
  </code></pre>
  
  <p>EDIT:</p>
  
  <p>I played around with it and was able to get the results I wanted with the following code:</p>
  
  <pre><code>    for (int i = 0; i &lt; test; i++)
      {
          cout &lt;&lt; "Enter the student's first name: " &lt;&lt; endl;
          cin &gt;&gt; first;
          cout &lt;&lt; "Enter the student's last name: " &lt;&lt;endl;
          cin &gt;&gt; last;
  
          *(student+i) = first + " " + last;
  
  
  
          cout &lt;&lt; "Enter the test score for " &lt;&lt; *(student+i) &lt;&lt; " : "&lt;&lt; endl;
          cin &gt;&gt; *(scores+i);
  </code></pre>