64,642
社区成员
发帖
与我相关
我的任务
分享
#include <assert.h>
#include <iostream>
using namespace std;
char* mystrcpy(char* dest,const char* source)
{
assert(dest!=NULL&&source!=NULL);
while(*dest++ = *source++);
return dest;
}
int main()
{
int a = 3;
char *dest;
dest = (char*)malloc(10);
cout << mystrcpy(dest,"hello") << endl;
return 0;
}
char* mystrcpy(char* dest,const char* source)
{
assert(dest!=NULL&&source!=NULL);
char *ptr=dest;
while(*dest++ = *source++);
return dest;
}
#include <assert.h>
#include <iostream>
using namespace std;
void mystrcpy(char* dest,const char* source)
{
assert(dest!=NULL&&source!=NULL);
while(*dest++ = *source++);
}
int main()
{
int a = 3;
char *dest;
dest = (char*)malloc(10);
mystrcpy(dest,"hello");
cout << dest << endl;
return 0;
}