VS2022 scanf函数使用报错-C4996 ‘scanf‘: This function or variable may be unsafe.

错误界面:

 错误显示:

代码:C4996    'scanf': This function or variable may be unsafe.Consider using scanf_s instead.To disable deprecation, use _CRT_SECURE_NO_WARNINGS.See online help for details.

解决方案:

在第一行加入如下所示代码:

#define _CRT_SECURE_NO_WARNINGS

再次运行:

 问题解决。

猜你喜欢

转载自blog.csdn.net/weixin_52849741/article/details/127465721