C PROGRAM TO ECHO "*" - C PROGRAM TO GET PASSWORD FROM USER

How to Enter Password in C language:
  Have you ever wondered how you can echo '*' when user input sensitive information in C, Same as we observe in a webpage by just typing:

<input type = "password"/>

Now, Doing the same in C is also simple i just wondered how to do that and came up with solution
 
#include <stdio.h>
#include <conio.h>

void main(){
      char pass[100];
      int i = 0;
       do{
            pass[i] = getch();
            if(pass[i]  == '\n'){
                    break;                // if user press enter it breaks the loop..
            }
            printf("*");
            i++;
       } while(1); // Always true You can put your condition here..
}
If you like my code then feel free to comment your feedback and share  & subscribe this post.
KUDOS!!

Comments

Popular posts from this blog

NPTEL Introduction to programming in c Assignment 4 solutions

Code to Implement Dynamic Queue in C++ using arrays