char * strdup(char *str) { char * strNew; assert(str != NULL); strNew = (char *)malloc(strlen(str)+1); strcpy(strNew,str); return strNew; }
时间: 2024-12-21 12:09:26
char * strdup(char *str) { char * strNew; assert(str != NULL); strNew = (char *)malloc(strlen(str)+1); strcpy(strNew,str); return strNew; }