title: How do I return a array from a function?
body: <p>I'm learning about pointers in class but I never really understood arrays 100%</p>
  
  <p>I have a assignment where I have to read in an array of student scores from a function. Each element of the array would hold a different score and the element identifies what student it is.</p>
  
  <p>I'm trying to read the scores into a array but when it comes to returning it I'm lost. I've tried google but just get more confused because people talking about dynamic memory and using the new and delete operand which I haven't gotten to yet, and I don't want to do the 
  assignment wrong.</p>
  
  <p>I have to user pointer instead of index to access elements in the array.
   The code below gives me the error "redefinition of formal parameter 'scoreArray'"</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  const int maxStudents = 30;
  double readScores(double[]);
  
  int main()
  {
      double scoreArray[maxStudents];
      readScores(scoreArray);
  
      cout&lt;&lt;scoreArray[1],scoreArray[2];
  
      system ("PAUSE");
      return 0;
  }
  
  double readScores(double scoreArray)
  {
      double scoreArray[maxStudents];
      double *scorePTR;
      *scorePTR = scoreArray;
  
      for(int count = 0; count &lt; maxStudents; count++)
      {
          cout&lt;&lt;"Please enter score for student "&lt;&lt;count+1&lt;&lt;" or -999 to end.\n";
          cin&gt;&gt;*(scorePTR+count);
          if(*(scorePTR+count) == -999)
          break;
      }
  }
  </code></pre>