#include<stdio.h>
#include<stdlib.h>
#include<assert.h>
void stringcpy(char *to,const char *from)
{
assert(to != NULL && from != NULL);
while(*from != '\0')
*to++ = *from++;
*to = '\0';
}
int main()
{
char *f;
char *t;
f = (char *)malloc(15);
t = (char *)malloc(15);
stringcpy(f,"123456");
stringcpy(t,f);
printf("t=%s\n",t);
return 0;
}
不调用字符串库函数,实现字符串复制函数
最新推荐文章于 2023-10-10 20:02:17 发布