VS2008编C的时候,scanf怎么会报警告

来源:互联网 发布:仿阿里云首页效果 编辑:程序博客网 时间:2024/06/02 09:34

1> warning 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.

scanf的声明在VS2005中被认为是不安全的,让你使用scanf_S来代替。只要在#include <stdio.h>前面添加
#define _CRT_SECURE_NO_DEPRECATE 或者 scanf函数修改为scanf_s即可。