char * strdup(char *str) { char * strNew; assert(str != NULL); strNew = (char *)malloc(strlen(str)+1); strcpy(strNew,str); return strNew; }
时间: 2024-10-12 19:16:29
char * strdup(char *str) { char * strNew; assert(str != NULL); strNew = (char *)malloc(strlen(str)+1); strcpy(strNew,str); return strNew; }