#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void copy_string(char *from, char *to);
int main()
{
char from[]="you are a student";
char *a = from;
char *b =(char *) malloc(strlen(a) + 1);
printf("string a=%s\nstring b=%s\n",a,b);
printf("copy string a to string b:\n ");
copy_string(a, b);
printf("\nstring a=%s\nstring b=%s\n",a,b);
free(b);
return 0;
}
void copy_string(char* from, char* to)
{
for(;*from !='\0';from++,to++)
*to = *from;
*to='\0';
}