STRDUP(3) Library Functions Manual STRDUP(3)

strdupduplicate a string

#include <string.h>

char *strdup(const char *s1);

The strdup() function returns a pointer to a new string, which is a duplicate of the string pointed to by s1 . The returned pointer can be passed to free(3) . A null pointer is returned if the new string cannot be created.

The strdup() function returns a pointer to a new string on success. Otherwise it returns a null pointer and sets errno to indicate the error.

The strdup() function may fail if:

Storage space available is insufficient.

None.

None.

None.

malloc(3) , free(3) , <string.h> .

February 1997 posix.fail