duplicate a string
#include <suplib/str.h>char *str_dup(const char *string);
const char *string
- the string to duplicate
str_dup
makes a duplicate copy of a string, allocating
space and copying the original into the new space. If the
passed pointer is NULL
, it returns NULL
.
Upon success, it returns a pointer to the duplicate string.
The user is responsible for freeing this memory. Upon failure
(i.e., out of memory) it returns NULL
Diab Jerius