.\" Copyright (c) 1990, 1991 The Regents of the University of California. .\" All rights reserved. .\" .\" %sccs.include.redist.man% .\" .\" @(#)strdup.3 5.3 (Berkeley) 04/19/91 .\" .Dd .Dt STRDUP 3 .Os .Sh NAME .Nm strdup .Nd save a copy of a string .Sh SYNOPSIS .Fd #include .Ft char * .Fn strdup "const char *str" .Sh DESCRIPTION The .Fn strdup function allocates sufficient memory for a copy of the string .Fa str , does the copy, and returns a pointer to it. The pointer may subsequently be used as an argument to the function .Xr free 3 . .Sh SEE ALSO .Xr calloc 3 .Xr malloc 3 .Xr realloc 3 .Xr free 3 .Sh HISTORY The .Fn strdup function .Ud .