考虑这段代码
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);
Run Code Online (Sandbox Code Playgroud)
我想你明白我想做什么:)
我读*密码"测试"但结果不是0,一些解释会很好:)
| 归档时间: |
|
| 查看次数: |
401 次 |
| 最近记录: |