strcpy_s的第二个参数的大小应大于源字符串或数组的长度,如
char temp[80];
cout << "Enter last name: ";
cin >> temp;
char * pn = new char[strlen(temp) + 1];
strcpy_s(pn,strlen(temp)+1,temp);//注意是strlen(temp)+1
有更为安全的函数strncpy_s,建议学习
strcpy_s的第二个参数的大小应大于源字符串或数组的长度,如
char temp[80];
cout << "Enter last name: ";
cin >> temp;
char * pn = new char[strlen(temp) + 1];
strcpy_s(pn,strlen(temp)+1,temp);//注意是strlen(temp)+1
有更为安全的函数strncpy_s,建议学习