title: gets() is not taking input in C
body: <p>Okay so I am writing this simple piece of code and I am just a beginner in C. This code compiles and runs as expected but when I get to the point where I must enter an address this code just skips the input, but when I use scanf in that place the code runs perfectly can anyone help me out?</p>
  
  <p><strong>SOURCE</strong></p>
  
  <pre><code>#include&lt;stdio.h&gt;
  #include&lt;conio.h&gt;
  
  void main()
  {
      struct student
      {
          int rn;
          long int phn;
          char name[50];
          char add[50];
      }s;
  
      char ans, filename[15];
  
      FILE *fp;
      printf("\n Enter File Name : ");
      gets(filename);
      fp=fopen(filename, "w");
  
      again:
      printf("\n Enter a name of a student : ");
      gets(s.name);
      printf("\n Enter his roll number : ");
      scanf(" %d ", &amp;s.rn);
      printf("\n Enter his address : ");
      gets( s.add);
      printf("\n Enter his phone Number : ");
      scanf("%ld", &amp;s.phn);
      fprintf(fp, "%s\t%d\t%s\t%ld\n", s.name, s.rn, s.add, s.phn);
      printf("\n Want to keep next record ? : ");
      fflush(stdin);
      scanf("%c", &amp;ans);
      if(ans=='y'||ans=='Y')
      goto again;
      fclose(fp);
      getch();
  }
  </code></pre>
  
  <p>I want a detailed explanation to this can anyone help me out?</p>