title: C - trying to read a single char from stdin (and failing) w/ scanf / getchar
body: <p>as a part of a homework assignment, I'm trying to read a single char from stdin, and act according to it:</p>
  
  <pre><code>char choice;
  
  while (1) {
      printf("please enter [y]es, [n]o or [m]aybe: ");
      scanf("%c", choice);
      fflush(stdin);
      // validate input
      if (choice == 'y' || choice == 'n' || choice == 'm') {
          break;
      } else {
        printf("Please enter only \'y\', \'n\' or \'m\'!\n");
      }
  }
  // do something with the input
  if (choice == 'y') {
      printf("you selected yes!\n");
  }
  </code></pre>
  
  <p>for some reason, scanf captures both the char and the line-feed after, thus it proceeds to do something with the input and then also prints the "Please enter only 'y', 'n' or 'm'!" line. If I enter several characters on the stdin, it will print that line for all of them, while also performing correctly for the first char. So, for example:
  </p>
  
  <pre class="lang-none prettyprint-override"><code>$ ./run
  please enter [y]es, [n]o or [m]aybe: y&lt;return&gt;
  you selected yes!
  Please enter only 'y', 'n' or 'm'!
  $ ./run
  please enter [y]es, [n]o or [m]aybe: yes&lt;return&gt;
  you selected yes!
  Please enter only 'y', 'n' or 'm'!
  Please enter only 'y', 'n' or 'm'!
  Please enter only 'y', 'n' or 'm'!
  $
  </code></pre>
  
  <p>Same thing happens if I use getchar. What am I missing? thanks.</p>