title: Why fgets is not inputting first value?
body: <p>I am writing a program to write my html files rapidly. And when I came to write the content of my page I got a problem.</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  
  int main()
  {
  int track;
  int question_no;
  
  printf("\nHow many questions?\t");
  
  scanf("%d",&amp;question_no);
  
  char question[question_no][100];
  
      for(track=1;track&lt;=question_no;track++)
      {
          printf("\n&lt;div class=\"question\"&gt;%d. ",track);
          printf("\nQuestion number %d.\t",track);
          fgets(question[track-1],sizeof(question[track-1]),stdin);
          printf("\n\n\tQ%d. %s &lt;/div&gt;",track,question[track-1]);
      }
  
  }
  </code></pre>
  
  <p>In this program I am writing some questions and their answers (in html file). When I test run this program I input the value of <code>question_no</code> to 3. But when I enter my first question it doesn't go in <code>question[0]</code> and consequently the first question doesn't output. The rest of the questions input without issue.<br/><br/></p>
  
  <p>I searched some questions on stackoverflow and found that <code>fgets()</code> looks for last <code>\0</code> character and that <code>\0</code> stops it.<br/>
  I also found that I should use <b>buffer</b> to input well through <code>fgets()</code> so I used: <code>setvbuf</code> and <code>setbuf</code> but that also didn't work (I may have coded that wrong). I also used <code>fflush(stdin)</code> after my first and last (as well) <code>scanf</code> statement to remove any <code>\0</code> character from stdin but that also didn't work.<br/><br/></p>
  
  <p>Is there any way to accept the first input by <code>fgets()</code>?<br/>
  <em>I am using stdin and stdout for now. I am not accessing, reading or writing any file.</em></p>