问个比较初级的问题,自己写的字符串复制函数,总是编译过,运行不过
											 程序代码:
程序代码:
#include <stdio.h>
int str_cpy(char * from, char * to)
{
    int i = 0;
    while((*(from+i)) != '\0'){
                      printf("%c", *(from+i));
        *(to + i) = *(from + i);
        
        i++;        
    }
    //*(to + i) = '\0';
    return i;
}
main()
{
      char * str1 = "I love";      
      char * str2;
      str_cpy(str1, str2);
      getch();
}      
我在网上查了很多相关的例子,似乎都和我的代码差不多,为什么我始终运行不过呢?
平台:windows xp sp2 + dev-C++



 
											





 
	    

 
	
 
											
