title: Read two characters consecutively using scanf() in C
body: <p>I am trying to input two characters from the user <code>t</code> number of times. Here is my code :    </p>
  
  <pre><code>int main()
  {
      int t;
      scanf("%d",&amp;t);
      char a,b;
  
      for(i=0; i&lt;t; i++)
      {
          printf("enter a: ");
          scanf("%c",&amp;a);
  
          printf("enter b:");
          scanf("%c",&amp;b);
      }
      return 0;
  }
  </code></pre>
  
  <p>Strangely the output the very first time is:</p>
  
  <pre><code>enter a: 
  enter b:
  </code></pre>
  
  <p>That is, the code doesn't wait for the value of <code>a</code>.</p>