strdup()

Creates a duplicate string in heap memory.

  #include <extras/extras_string.h>
  
  char * strdup(const char *str);    
Parameter

str

A pointer to a null-terminated character string to copy.

Remarks

This function returns a pointer to a newly-allocated, duplicated string or NULL if unsuccessful. This duplicated string may be released from heap memory with the _free() function.

This facility is not specified in the ISO/IEC standards. It is an EWL extension of the standard libraries.