且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

错误C4996:'scanf':该函数或变量在C编程中可能不安全

更新时间:2021-09-01 00:32:15

听起来像只是编译器警告.

It sounds like it's just a compiler warning.

使用scanf_s可以防止缓冲区溢出.
请参阅: http://code.wikia.com/wiki/Scanf_s

Usage of scanf_s prevents possible buffer overflow.
See: http://code.wikia.com/wiki/Scanf_s

关于为什么scanf可能是危险的很好的解释: scanf的缺点

Good explanation as to why scanf can be dangerous: Disadvantages of scanf

因此,按照建议,您可以尝试将scanf替换为scanf_s或禁用编译器警告.

So as suggested, you can try replacing scanf with scanf_s or disable the compiler warning.