Get input in c as a password field:(*****)


[** only for windows users]]

#include <stdio.h>
#include <string.h>

int main()
{
char word1[8]=”shadhin”;
char word2[8];
char c;
int i=0;
while(1)
{c=getch();
if(c==13)
{
word2[i]=”;
break;
}

word2[i]=c;
printf(“*”);
i++;

}

if(strcmp(word1,word2) == 0)
printf(“nPassword is correct”);
else
printf(“nPassword is incorrect”);
}
</code>