considering this piece of code
char *pass="test";
int keyPressed;
char *password=(char *)malloc(PASS_LENGTH*sizeof(char));
int index=0;
printf("Enter the password please\n");
do
{
keyPressed=getch();
password[index++]=keyPressed;
}
while(keyPressed!=13);
int result=strcmp(pass,password);
i think you understand what i want to do :)
i read in *password "test" but result is not 0, some explanation would be good:)