c语言入门:跳过剩余的输入行

#include <stdio.h>
int main(void)
{
int guess=1;
while(getchar()!='y')
{
    printf("%d",++guess);
    while(getchar()!='\n')
    continue;
}

return 0;
}

结尾的这个while循环
while(getchar()!='\n')
continue;
我知道是用来跳过剩余输入部分的
但为什么【enter】它也可以跳啊
关系表达式的条件不是不为换行符的字符可以循环吗?

continue表示的是跳过循环体内剩余部分直接执行下一次循环,你把输入语句先到while的判断语句中是无法通过continue跳过的