本帖最后由 2370177068 于 2022-10-8 18:16 编辑
我试了下,X64正常,X86在12行直接报错,运行不了
代码如下,不想自己写的ctrl c v再改一下
[C++] 纯文本查看 复制代码 //#include <Windows.h>
#include <iostream>
using namespace std;
#pragma warning(disable : 4996)
int main() {
const char* a = "123abc";
cout << "=====================" << endl;
char b[sizeof(a) + 1] = "";
cout << "a:" << a << endl;
strcpy_s(b, a);
cout << "a:" << a << endl;
cout << "b:" << b << endl;
cout << "=====================" << endl;
char c[sizeof(a)] = "";
strcpy(c, a);
cout << "a:" << a << endl;
cout << "c:" << c << endl;
} |