例10.5
//自己写strcpy函数
#include <stdio.h>
#include <stdlib.h>
#define N 80
void mystrcpy(char *dststr,char *srcstr);
int main()
{
char a[N],b[N];
printf("input a string:");
gets(a);
mystrcpy(b,a);
puts(b);
return 0;
}
void mystrcpy(char *dststr,char *srcstr)
{
while(*srcstr!='\0')
{
*dststr=*srcstr;
dststr++;
srcstr++;
}
*dststr='\0';
}