Go to the first, previous, next, last section, table of contents.


strdup

Syntax

#include <string.h>

char * strdup (const char *source);

Description

Returns a newly allocated area of memory that contains a duplicate of the string pointed to by source. The memory returned by this call must be freed by the caller.

Return Value

Returns the newly allocated string, or NULL if there is no more memory.

Portability

not ANSI, not POSIX

Example

char *foo()
{
  return strdup("hello");
}


Go to the first, previous, next, last section, table of contents.