2 void copy_string (char from[],char to[])
{
char *p1,*p2;
p1=from;
p2=t0;
while ((*p2++=*p1++)!='\0');
}
======================>
equal:
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#define BUFFER 80
void copy_string(char *ch_to, const char *ch_from);
int main(void)
{
char ch_from[] = "fanyunfei";
char ch_to[BUFFER];
copy_string(ch_to, ch_from);
printf("ch_to = %s\n", ch_to);
exit(0);
}
void copy_string(char *ch_to, const char *ch_from)
{
assert((ch_to != NULL) && (ch_from != NULL));
while ((*ch_to++ = *ch_from++) != '\0') ;
}