title: Array of structures not storing data as expected
body: <p>I wrote the following code which is supposed to read an input, n = number of people, then create an array of structs the size of n, then read the info of each person and finally print all the info in order.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int main() {
  
      int n;
      scanf("%d", &amp;n);
  
      struct person {
          char name[51];
          int age;
      };
      struct person list[n];
  
      int i;
      for(i = 0; i &lt; n; i++) {
          scanf("%s", list[n].name);
          scanf("%d", &amp;list[n].age);
      }
  
      for(i = 0; i &lt; n; i++) {
          printf("Name: %s - Age: %d\n", list[i].name, list[i].age);
      }
  
      return 0;
  }
  </code></pre>
  
  <p>So I compiled it using GCC on Ubuntu, executed and provided the following inputs:</p>
  
  <pre><code>1
  Lucia
  60
  </code></pre>
  
  <p>But instead of getting <code>Name: Lucia - Age: 60</code> on the terminal, I'm getting <code>Name: �rI�� - Age: 32766</code> which I believe is random trash in the computer's memory. I'm using the same treatment of arrays of structs I see in some web pages and in my college's material, so why doesn't it store the data properly?</p>