strdup实现

char * strdup(char *str)  
{
   char * strNew;
   assert(str != NULL);
   strNew = (char *)malloc(strlen(str)+1);
   strcpy(strNew,str);
   return strNew;
}    
原文地址:https://www.cnblogs.com/timssd/p/4091021.html