www.delorie.com/djgpp/doc/libc/libc_758.html   search  
libc.a reference

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

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

ANSI/ISO C No
POSIX No

Example

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


  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2004   by DJ Delorie     Updated Apr 2004