StrDup

char *StrDup (const char stringToDuplicate[]);

Purpose

Allocates and returns a copy of a string. The caller must dispose of the string using the free function.

Parameters

Input
Name Type Description
stringToDuplicate const char [] Pass the string to be duplicated.

Return Value

Name Type Description
duplicatedString char * Returns a pointer to a newly allocated memory block containing a copy of the stringToDuplicate. If there is not enough memory to copy the string or if stringToDuplicate is passed a value of zero, then a value of zero is returned.