title: While loop in C
body: <p>Could anyone please explain to me why my while loop won't end when i enter character 'Q'? It kept on looping even though i set my boolean value to false when the user enter 'Q', it supposed to end after that scanf for <code>char input</code>.</p>
  
  <p>My code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  typedef int bool;
  #define true 1
  #define false 0
  
  int main(void) {
      char input;
      char output;
      bool tf = true;
  
      printf("Welcome to the Coder!\n");
  
      while (tf) {
          printf("Choose Input (H,A,B,Q) : ");
          scanf_s(" %c\n", &amp;input);
  
          if (input == 'Q') {
              tf = false;
          }
          else {
              printf("Choose Output (H,A,B) : ");
              scanf_s(" %c\n", &amp;output);
          }
      }
  
      return 0;
  }
  </code></pre>