title: Hide user input, and only allow certain characters
body: <p>Is there any way to hide user input when asked for in C?
  For example:</p>
  
  <pre><code>char *str = malloc(sizeof(char *));
  printf("Enter something: ");
  scanf("%s", str);getchar();
  printf("\nYou entered: %s", str);
  
  // This program would show you what you were writing something as you wrote it. 
  // Is there any way to stop that?
  </code></pre>
  
  <p>Another thing, is how can you only allow certain characters?
  For example:</p>
  
  <pre><code>char c;
  printf("Yes or No? (y/n): ");
  scanf("%c", &amp;c);getchar();
  printf("\nYou entered: %c", c);
  
  // No matter what the user inputs, it will show up, can you restrict that only 
  // showing up if y or n are entered?
  </code></pre>