C4996 ‘scanf‘: This function or variable may be unsafe. Consider using scanf_s instead. To disable d

错误 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.解决方法

1.把scanf改成scanf_s(不推荐,这个方法是vs自己定义的,在其他编辑器里不可以使用,降低了代码的可移植性)

C4996	‘scanf‘: This function or variable may be unsafe. Consider using scanf_s instead. To disable d

2.在代码最前面加#define _CRT_SECURE_NO_WARNINGS 1(推荐)

C4996	‘scanf‘: This function or variable may be unsafe. Consider using scanf_s instead. To disable d