title: Returning a global array in c++
body: <p>How do I return a global array that was populated inside a function so that I can use it in other functions in C++? </p>
  
  <p>for example:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;stdio.h&gt;
  
  using namespace std;
  
  int global[10]
  
  //POPULATE THE ARRAY HERE
  int functionReturnArray()
  {
  int i;
  
       for(i=0;i&lt;=9;i++)
       {
        global[i] =i;
  
        if(i==9)
          {
           return global;
           }
        } 
  
  }//close function
  
  int main()
  {
        int local = functionReturnArray();
        for(int i=0;i&lt;10;i++)
        local[i];// I WANT TO USE THE ARRAY HERE
        return 0
  }
  </code></pre>
  
  <p>Thanks</p>