title: print an int array in a file in C
body: <p>I need to write a file(not binary) with students and each ones grades(int note[10] under this form). I do not get any errors but when I try to write the file just the last grade is printed, and I don't know how to print the entire list. For example (int nr_note means how many grades does the student have) if a students grades are 6, 8, 9 it just prints the 9.
  Thank you in advance. </p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  struct student{
      int nr_matricol;
      char nume[10];
      int nr_note;
      int note[10];
  };
  
  void citire_date(struct student *studenti, int n, FILE *f){
      int i, j;
  
      for(i=0;i&lt;n;i++){
          printf("Studentul %d\n", i+1);
          printf("Numarul matricol: "); scanf("%d", &amp;(studenti+i)-&gt;nr_matricol);
          printf("Numele studentului: "); fflush(stdin); gets((studenti+i)-&gt;nume);
          printf("Numarul de note: "); scanf("%d", &amp;(studenti+i)-&gt;nr_note);
          for(j=0;j&lt;((studenti+i)-&gt;nr_note);j++){
              printf("Nota %d: ", j+1); scanf("%d", &amp;(studenti+i)-&gt;note[i]);
          }
          fprintf(f, "Numar matricol: %d\nNume: %s\nNote: %d \n", ((studenti+i)-&gt;nr_matricol) ,((studenti+i)-&gt;nume), ((studenti+i)-&gt;note[i]));
      }
  }
  
  int main()
  {
      struct student studenti[20];
      FILE *f;
      int n;
  
      f = fopen("studenti.txt", "w");
      if(f==NULL){
          printf("Nu s-a putut deschide/crea fisierul pentru scriere.");
          exit(1);
      }
  
      printf("Introduceti numarul de studenti: "); scanf("%d", &amp;n);
      citire_date(studenti, n, f);
      fclose(f);
  
  
      return 0;
  }
  </code></pre>