title: C++ char pointer array - cannot access elements
body: <p>I am having some trouble storing some char pointers in my array</p>
  
  <p>The method should take a char* array and and int pointer which is the size of the array. Then I loop and ask the user to enter the names. Then I want to print them; however it seems like there's nothing in my array.</p>
  
  <p>Note I cannot use array notation for this assignment, I must use pointer notation to access the elements of the array.</p>
  
  <pre><code>void sort_name(char* name[], int* items)
  {
    //store the names
      cout &lt;&lt; "In function items is " &lt;&lt; *items &lt;&lt; endl;
  
      for(int i=0; i&lt;*items; i++)
      {
          string str;
          cout &lt;&lt; "Enter name #" &lt;&lt; (i+1) &lt;&lt; ": ";
          getline(cin, str);
  
          char* current = new char[str.size() + 1];
          *(name + i) = current;
      }
  
      for(int i=0; i&lt;*items; i++)
      {
          cout &lt;&lt; *(name + i) &lt;&lt; endl;
      }
  
  
  
  }
  </code></pre>