Home
Questions
Search
Forum
Contact
Guest Book
Polls!
Got a Question?
 
PREV
Write your own ....
NEXT
 
(29 / 301)
 
 



Write a C program to implement your own strdup() function.




Here is a C program to implement the strdup() function.


char *mystrdup(char *s)
{
    char *result = (char*)malloc(strlen(s) + 1);
    if (result == (char*)0){return (char*)0;}
    strcpy(result, s);
    return result;
}



PREV
COMMENTS                                  INDEX                                  PRINT
NEXT



Last updated: November 3, 2005

www.cracktheinterview.com - Your destination for the most common IT interview questions, answers, frequently asked interview questions (FAQ), C Programs, C Datastructures for technical interviews conducted by the top IT companies around the world!