strdup

Syntax

char* strdup(const char* s)

Arguments

s
The string to be duplicated.

Return

Pointer to the new string.

Description

Duplicates the string s into a newly allocated memory location.

Since this function allocates memory, the newly created string must at some point be destroyed by means of the free function.