#include "stdafx.h"
#include <string.h>
#include <assert.h>
//using namespace std;
char* strcpy(char* strDest,char* strSrc){
assert((strDest!=NULL) && (strSrc!=NULL));
if(strDest==strSrc) return strDest;
char * address = strDest;
while((*strDest++ = *strSrc++)!='\0');
return address;
}
int main(int argc, char** argv)
{
char s[] = "safe";
char *t = new char;
strcpy(t,s);
printf("%s\n",t);
return 0;
}
自行编写strcpy()函数
最新推荐文章于 2023-09-19 09:28:09 发布