vs上编译不通过,慕课上却可以,寻求原因
#include <string.h> #include <iostream> using namespace std; int main(void) { //在堆中申请100个char类型的内存 char *str = new char[100]; //拷贝Hello C++字符串到分配的堆中的内存中 strcpy(str, "Hello imooc"); //打印字符串 cout << str << endl; //释放内存 delete[]str; str = NULL; return 0; }
错误 1 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.
错误就是以上所描述,想不通那个代码有什么问题