Print asterisk (*) in every input (as like password ) in C

CODE

#include<stdio.h>
#include<conio.h>
void main()
{
char pwd[80],ch;
int n=0;
clrscr();
while(1)
{
ch=getch();
if(ch==13)
{
pwd[n]=’\0′;
break;
}
pwd[n]=ch;
n++;
printf(“*”);
}
printf(“\n%s”,pwd);
getch();
}

 

OUTPUT

Leave a Reply