yOuR seArCh eNdS hEre
Monday, July 23, 2012
Write your own C program to implement "strdup()" function.
char *mystrdup(char *s)
{
char *result = (char*)malloc(strlen(s)*sizeof(char) + 1)
;
if (result == NULL)
{
return NULL;
}
strcpy(result, s);
return result;
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment