title: How can I change an int array in a function
body: <p>Im new with c language and im having difficult while trying to change an array on my main function using another function. Besides seeing the solution I'd also like to get a full explanation what is wrong with my code and what's the explanation to your solution. </p>
  
  <p>OK so I did too much tryouts and error experimentation but with no success to solve my problem. Eventually this is my current code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #define MAX 20
  typedef int Values[MAX];
  
  int changeArr(Values *vals2) 
  {
      *vals2[0] = 200;
      *vals2[1] = 100;
      printf("%d and ", *vals2[0]);
      printf("%d\n", *vals2[1]);
      return 0;
  }   
  
  int main (int argc, char *argv[]) 
  {
      Values vals;
      changeArr(&amp;vals);
      printf("%d and ", vals[0]);
      printf("%d\n", vals[1]);
      return 0;
  }
  </code></pre>
  
  <p>Output is:</p>
  
  <pre><code>200 and 100
  200 and 0
  </code></pre>
  
  <p>Instead of:</p>
  
  <pre><code>200 and 100
  200 and 100
  </code></pre>