字符串拷贝 strdup

两个字符串 char* from, char* to;要把from的内容复制给to。 
用strcpy(to, from)出现memory问题, 
使用 to = strdup(from)会自动malloc 空间

但是不会自动free 需要手动free

原文地址:https://www.cnblogs.com/banwhui/p/5485738.html