Print * in place of characters for reading passwords in C
While writing a C program, if you want to type password and it should not be visible on screen or an * symbol is to be printed.
Input : abcdefg Output : *******
Note : Below solution uses getch() which may not work on all compilers as this is a non-standard function.
Explanation: Basically it is taking the characters we enter through getch() function and print * instead of it for every letter we type.
Remark: It doesn’t run in this IDE, download this file and run in your terminal.
This article is contributed by Pavan Gopal Rayapati. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.