title: Assigning values to an array of ints through a function in C
body: <p>I am making a weird unpractical program that calls four functions.</p>
  
  <p>First function reads 30 integers to an array;</p>
  
  <p>Second does the same but to another array;</p>
  
  <p>Third should make another array with 60 elements, half being the elements of the first array, other half being the elements of the second array;</p>
  
  <p>Fourth will show the entire array to the user.</p>
  
  <p>I'm stuck on my third function. I am not finding anything explaining how to change the values of an array of integers through a function.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  void array1(int *a1);
  void array2(int *a2);
  void mash(int *a1, int *a2, int *a);
  void exhibit(int *a);
  
  int main()
  {
      int a1[30];
      array1(a1);
  
  
      int a2[30];
      array2(a2);
  
  
      int a[60];
      mash(a1, a2, a);
  
  
      exhibit(a);
  
  
      return 0;
  }
  
  
  void array1(int *a1)
  {
      int temp[30];
      for (int i = 0; i &lt; 30; i++)
      {
          scanf("%i", a1 + i);
      }
  }
  
  
  void array2(int *a2)
  {
      for (int i = 0; i &lt; 30; i++)
      {
          scanf("%i", a2 + i);
      }
  }
  
  
  void mash(int *a1, int *a2, int *a)
  {
      for (int i = 0; i &lt; 30; i++)
      {
          a + i = a1 + i;
      }
  }
  
  
  void exhibit(int *a)
  {
  
  }
  </code></pre>
  
  <p>I thought I should be able to access each element by adding 1 to the pointer as I did to get input on my earlier functions.</p>