title: passing array to function
body: <p>i am trying to pass an array between two functions. The _data function is my array. It takes 3 parameters; the array itself, the size of the array and the file name of the array. So this function should get each element from the input file(.txt) and put it into the array, which it seems to do ok.</p>
  
  <pre><code>void _data(string dataArray[], int sizeOfArray, ifstream &amp;fin)
  {
      const int CharBuffer=20;
      char linedata[CharBuffer];
      ifstream&amp; getline (char* s, streamsize n );
  
      for(int x = 0; x &lt; sizeOfArray; x++)
      {
          fin.getline(linedata, CharBuffer);
          dataArray[x]=linedata;
          cout &lt;&lt; dataArray[x] &lt;&lt; endl;
      }
  }
  
  ifstream&amp; operator&gt;&gt;(ifstream &amp;fin, ArrayIntStorage &amp;AIS)
  {
      string acwData[10000];
      _data(acwData, 10000, fin);
      return fin;
  }
  </code></pre>
  
  <p>but in the next part I need to output the values from my array to a text file which I must do in a separate function. </p>
  
  <p><strong>So my question is, how can I access the data stored in the acwData array above in the function below?</strong>(or any other function)</p>
  
  <pre><code>ofstream&amp; operator&lt;&lt;(ofstream&amp; fout, ArrayIntStorage&amp; AIS)
  {
      return fout;
  }
  </code></pre>
  
  <p>do i need to initialize my array function differently to include a return type?</p>