c语言入门:输入验证

long get_long(void)
{
long input;
char ch;
while(scanf("%ld",&input)!=1)
{
while((ch=getchar())!='\n')
putchar(ch);
printf(" is not an integer.\nplease enter an ");
printf("integer value,such as 25,-178,or3: ");
}
return input;
}

这如果我输个abc那下面这两个printf是要打印三次吗

不会,
printf(" is not an integer.\nplease enter an ");
printf("integer value,such as 25,-178,or3: ");
是属于循环while(scanf("%ld",&input)!=1)中的,scanf只有回车才确定输入,
所以只输出一次