Oculte a entrada do usuário e permita apenas determinados caracteres
Existe alguma maneira de ocultar a entrada do usuário quando solicitado em C? Por exemplo
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?
Outra coisa, é como você pode permitir apenas determinados caracteres? Por exemplo
char c;
printf("Yes or No? (y/n): ");
scanf("%c", &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?