我能运行呀!
#include
using namespace std;
void my_strcpy(char* dest, const char* source);
int main()
{
char a[20] = "How are you";
char b[20];
my_strcpy(b,a);//最好不要用系统的函数名
cout << b << endl;
}
void my_strcpy(char* dest, const char* source)
{
for (int j = 0; source[j] != '\0'; ++j)
dest[j] = source[j];
//return dest;//不需要返回值
}
你没有把最后的0复制过去
for (int j = 0; source[j] != '\0'; ++j)
{ dest[j] = source[j];}
dest[j] = source[j];
return dest;