是否“scanf”取消功能“获取”? [英] Does "scanf" cancel the function "gets"?
本文介绍了是否“scanf”取消功能“获取”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
int flag=1,n;
char string[200];
printf("Enter number <0-5> : \n");
scanf("%d",&n);
printf("Insert string <bigger than the number above> : ");
while(flag)
{
gets(string);
flag=CheckNumOfWords(string,n);
}
大家好
所以当我运行脚本时它不会暂停,所以我可以输入我的字符串,他跳过funcgets(string),但当我删除scanf(%d,& n)获取(字符串)工作正常
任何建议或评论?
tnx!
Hi guys
so when i run the script it doesn''t pause so i can enter my string, he skips the func "gets(string)", but when i remove the "scanf("%d",&n)" the "gets(string)" workes fine
any suggestions or comments?
tnx!
推荐答案
这些函数都没有取消任何东西。在调试器下执行此代码;你会清楚地看到发生了什么。
-SA
None of those functions "cancels" anything. Execute this code under the debugger; and you will clearly see what goes on.
—SA
这篇关于是否“scanf”取消功能“获取”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文