title: Function to change array data - data not changing. C
body: <p>I'm new to C but I've programmed in pascal a few weeks ago. In pascal, if you want to change an arrays data, you pass by reference, by typing <code>var myArray</code> essentially. I can't figure out how to do this in C. I've read a ton of questions but none seem to work. Here's what I have so far.</p>
  
  <pre><code>void set_up_elements(char (*array_to_populate)[20])
  {
      char* buffer;
      FILE *f;
      f=fopen("elementList.txt","r");
      char copied_text[118][20];
      int i=0;
      while (!feof(f))
      {
          fgets(copied_text[i],80,f);
          ++i;
      }
      //Close the file to free up memory and prevent leaks
      fclose(f);
      f = NULL;
  }
  </code></pre>
  
  <p>Here is my code to populate the array, i read a list of the elements in the periodic table in to the array <code>copied_text</code>. This part works, it successfully populates the array that is INSIDE the function.</p>
  
  <pre><code>int main()
  {
      char element_array[118][20];
      set_up_elements(element_array);
  &lt;..&gt;
  }
  </code></pre>
  
  <p>This is how i'm trying to call it. The contents of the array <code>element_array</code> doesn't change. Does anyone know how to fix this? Thanks.</p>