home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / alde_c / misc / lib / dlibssrc / strdup.c < prev    next >
Encoding:
C/C++ Source or Header  |  1987-06-14  |  237 b   |  14 lines

  1. char *strdup(string)
  2. register char *string;
  3. /*
  4.  *    Create a copy of <string> and return a pointer to the copy.
  5.  */
  6. {
  7.     register char *p;
  8.     char *malloc();
  9.  
  10.     if(p = malloc(strlen(string) + 1))
  11.         strcpy(p, string);
  12.     return(p);
  13. }
  14.