title: ScanF Loop Fails to Read Single Character
body: <p>I'm implementing a BST. (i = insert, s = search, p = print). Insert and search both take two arguments separated by a space in a line, and perform the necessary duties. However, print is only suppose to take in <strong>one</strong> argument, p, which then proceeds to print the tree.</p>
  
  <p>Whenever I input <strong>p</strong> in my command line argument, or any other character really, the loop is waiting for another input. If I input i followed by a number, the program resumes. The <strong>printf</strong> statement doesn't even get executed, so the <strong>ch == 'p'</strong> doesn't even trigger. Any advice?</p>
  
  <pre><code>int main(int argc, char **argv) {
  
          char ch;
          int i;
          Node *root = NULL;
          while(scanf(" %c",&amp;ch) != EOF) {
                  if(ch == 'i') {
                          scanf(" %d", &amp;i);
                          InsertNode(&amp;root, newNode(i));
                  }
                  if(ch == 's') {
                          scanf(" %d", &amp;i);
                          if(SearchNode(root,i) == 0) {
                                  printf("absent\n");
                          }
                          else {
                                  printf("present\n");
                          }
                  if(ch == 'p') {
                          printf("Trying to recursively print!");
                          return 0;
                          InOrderRecursive(root);
                  }
  }
  }
  
      return EXIT_SUCCESS;
  }
  </code></pre>