scanf和scanf_s有什么区别?在大学里,我一直在学习和使用scanf,但在我的个人电脑上,Visual Studio一直在发送这个警告。error C4996: 'scanf': This function or variable may be unsafe. Consider using scanf_s instead.我必须将所有scanf更改为scanf_s,否则程序将无法构建。(我正在使用Visual Studio 2013)
有没有人可以帮我验证下面Scanf的输入。我想让程序要求重新输入数据,如果扫描在错误的范围内或不是整数。我之前用if语句放入了一个do while循环,但当我编译它时,第一个printf和scanf只是循环#include <stdlib.h>
printf("Enter Destination Number between 1-1024:\n");
s