title: Use an array in main() in another function in c++
body: <p>Hello I have a task to make a function that fills an array, made in main(), and then use the array in another function, where I should make some calculations with it. I already have some code, could you please assist me how to do it? Thank you in advance</p>
  
  <pre><code>#include &lt;iostream&gt;;
  using namespace std;
  
  int* modArray(int* a, int size) {
  
      for (int i = 0; i &lt; size ; i++) {
          a[i] = i;
      }
      return a;
  }
  
  int modAddition() {} // This is the function, where I want to use, the "a" array
  
  int main() {
  
      int size = 7;
      int* a = new int[size];
  
      a = modArray(a, size);
  
      system("pause");
  
      return 0;
  }
  </code></pre>