Back to index
Go to the source code of this file.
Definition at line 37 of file strndup.c.
Definition at line 41 of file strndup.c.
size_t len = __strnlen (s, n);
char *new = (char *) malloc (len + 1);
if (new == NULL)
new[len] = '\0';
return (char *) memcpy (new, s, len);