programming.nbk: Home | Index | Next Page: strncat(char *s1, const char *s2, size_t n) | Previous Page: strcpy(char *s1, const char *s2)


 strdup(const char *s1)

Description

The strdup() function allocates memory and copies into it the string addressed by s1, including the terminating null character. It is the user's responsibility to free the allocated storage by calling free().

Syntax

Parameters

Return Values

On success, strdup() returns a pointer to a newly allocated copy of the string s1. On failure, strdup() returns a null pointer and sets errno as follows:


programming.nbk: Home | Index | Next Page: strncat(char *s1, const char *s2, size_t n) | Previous Page: strcpy(char *s1, const char *s2)


Notebook exported on Monday, 7 July 2008, 18:56:06 PM Eastern Daylight Time