Prepare Interview

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

Language%20in%20C%20Interview%20Questions%20and%20Answers

Question: Sometimes you need to prompt the user for a password. When the user types in the password, the characters the user enters should not appear on the screen. A standard library function getpass( ) can be used to perform such function. Maximum number of characters that can be entered as password is 8.

Answer: main( )
{
char *pwd ;

pwd = getpass ( "Enter Password" ) ;

if ( strcmp ( pwd, "orgcity" ) )
printf ( "nPassword %s is incorrect", pwd ) ;
else
printf ( "nCorrect Password" ) ;
}
Is it helpful? Yes No

Most helpful rated by users:

©2024 WithoutBook