求助!新手问问题!多谢!
#include <iostream>using namespace std;
int main()
{const char *cp1="a and b";
const char *cp2="are f";
size_t len=strlen(cp1)+strlen(cp2);
char *result_str=new char[len+1];
strcpy(result_str,cp1);
strcat(result_str,cp2);
cout<<strcat(result_str,cp2)<<endl;
delete [] result_str;
return 0;
}
运行之后出现debug error!为什么?多谢!