copy_string函数没执行 怎么回事 有大佬吗
#include<stdio.h>int main()
{
void copy_string(char *from,char *to);
char *a="i am a student";
char *b="you are a student";
printf("string a:%s\nstring b:%s\n",a,b);
printf("\ncopy string a to b:\n");
copy_string(a,b);
printf("string a:%s\nstring b:%s\n",a,b);
return 0;
}
void copy_string(char *from,char *to)
{
while(*from!='\0')
{
*to=*from;
from++;
to++;
}
*to='\0';
}