(C语言)不明白scanf("%*s"),求解释啊
嵌入式小侠 2012-07-10 12:44:33 #include<stdio.h>
int main()
{
int code;
int status;
status=1;
while((status=scanf("%d",&code))!=1||(code<1||code>5))
{
if(status!=1)
scanf("%*s");
printf("Enter an integer from 1 to 5:");
}
printf("%d\n",code);
return 0;
}
//不懂上面的代码中的scanf("%*s"),大家帮我解释下吧,
scanf("%*s")可以用while(getchar()!='\n' continue;代替,
后一个语句我懂,前一个不懂