我有以下for循环,我提示用户输入一个4位数的引脚并按Enter键.有人可以向我解释while循环真正在做什么,因为我不完全理解它.
//user input for pin
for(i = 0; i < PIN_LENGTH; i++)
{
printf("Enter digit %d of your PIN: ", i);
user_pin[i] = getchar();
while (getchar() != '\n'); //what is this line doing??
}
Run Code Online (Sandbox Code Playgroud)