作业帮 > 综合 > 作业

while(scanf("%d%d",&a,&b)!

来源:学生作业帮 编辑:神马作文网作业帮 分类:综合作业 时间:2024/11/10 13:57:17
while(scanf("%d%d",&a,&b)!
while(scanf(
EOF=end of file 这回你知道什么意思了吧
scanf函数的返回值说明.
Returns the number of fields successfully converted and assigned; the return value does not include fields that were read but not assigned. A return value of 0 indicates that no fields were assigned.
If format is a NULL pointer, the invalid parameter handler is invoked, as described in Parameter Validation. If execution is allowed to continue, these functions return EOF and set errno to EINVAL.
EOF就是-1,是在stdio.h里定义的.
按照上面的说明,scanf函数只有在第一个参数为NULL(空指针)的情况下,才可能返回EOF,否则,返回成功格式化并赋值的参数个数(>=0).
所以,楼主你的这个循环,将是一个死循环.