title: Turbo C - Scanf to only accept one character
body: <p>I want to make scanf only accept one character, but I am not familiar with the method of doing so. can anyone help me here.</p>
  
  <p>here is my current code:</p>
  
  <pre><code>void push(S *stack){
        char e;
        S temp;
        temp=malloc(sizeof(struct stack));
        if(!temp){
           printf("Failed\n");
           return;
       }
       printf("Input value: \n");
       scanf(" %c", &amp;e);
       if(('a'&lt;=e &amp;&amp; e&lt;= 'z') || ('A'&lt;=e &amp;&amp; e&lt;= 'Z')){
           temp-&gt;data=e;
           if(*stack == NULL){
              temp-&gt;next = temp-&gt;prev = NULL;
              *stack=temp;
           } else {
             temp-&gt;next = *stack;
             (*stack)-&gt;prev = temp;
             temp-&gt;prev = NULL;
             *stack=temp;
           }
      printf("Success %c", e);     
      }else{
          printf("Failed %c", e);
      }  
  }
  </code></pre>
  
  <p>Forgot to mention:</p>
  
  <p>if i were to input "abc" it will be pushed in the stack as a,b and c. though it is correct i was hoping to have a way to nullify the input and only accept it if its only a single character, if this is possible of course? if not then i will stick with the current one, was just hoping for a better implementation. thank you</p>