title: Why does my fflush not work? Skips asking for string in loop
body: <p>I am trying to code a lab for class but in the output when I run it it only asks for the string once, and when it loops it skips letting me input it and goes to the next function. I put a <code>fflush</code> in there but it does not work. I am using visual studio 2015</p>
  
  <pre><code>#define _CRT_SECURE_NO_WARNINGS
  #include&lt;stdio.h&gt;
  #include&lt;stdlib.h&gt;
  
  #define size 3
  
  struct empsal
  {
      char first[15];
      int t1, t2, t3;
      float avg;
      char grade;
  };
  
  void load(struct empsal s[], int n)
  {
      int i;
      for (i = 0; i&lt;n; i++)
      {
          printf("Enter first name ");
          gets_s(s[i].first);
          printf("Enter 3 test scores ");
          scanf("%d%d%d", &amp;s[i].t1, &amp;s[i].t2, &amp;s[i].t3);
          s[i].avg = (s[i].t1 + s[i].t2 + s[i].t3) / (float)3;
          if (s[i].avg&gt;70)
              s[i].grade = 'p';
          if (s[i].avg&lt;70)
              s[i].grade = 'f';
          fflush(stdin);
      }
  }
  
  void print(struct empsal s[], int n)
  {
      int i;
      for (i = 0; i&lt;n; i++)
      {
          printf("%s\n", s[i].first);
          printf("%d %d %d\n", s[i].t1, s[i].t2, s[i].t3);
          printf("Average is %f Grade is %c\n\n", s[i].avg, s[i].grade);
      }
  }
  
  //sort
  void sort(struct empsal s[], int n)
  {
      int i, j;
      empsal t;
      for (i = 0; i&lt;n - 1; i++)
      {
          for (j = 0; j&lt;n - 1; j++)
          {
              t = s[j];
              s[j] = s[j + 1];
              s[j + 1] = t;
          }
      }
  }
  //amount passed
  void passed(struct empsal s[], int n)
  {
      int count = 0;
      int i;
      for (i = 0; i&lt;n; i++)
      {
          if (s[i].grade = 'p')
              count++;
      }
      printf("Number of passes %d\n\n", count);
  }
  
  void main()
  {
      empsal s[size];//array
      load(s, size);
      sort(s, size);
      passed(s, size);
      print(s, size);
  }
  </code></pre>
  
  <p>OUTPUT:</p>
  
  <p>Enter first name ammar
  Enter 3 test scores 90
  90
  90
  Enter first name Enter 3 test scores 80
  90
  100
  Enter first name Enter 3 test scores 90
  60
  80
  Number of passes 3</p>
  
  <p>90 60 80
  Average is 76.666664 Grade is p</p>
  
  <p>ammar
  90 90 90
  Average is 90.000000 Grade is p</p>
  
  <p>80 90 100
  Average is 90.000000 Grade is p</p>
  
  <p>Press any key to continue . . .</p>