问题描述:(VS2019环境)
error C4996: ‘strcpy’: This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
问题如何解决:
在头文件前添加如下代码:#define _CRT_SECURE_NO_WARNINGS
代码举例:
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <string.h>
int main()
{
char a[10];
char b[] = "China";
printf("%s", strcpy(a, b));
return 0;
}