---
name: "ustrdup"
section: "3alleg"
platform: "linux"
package: "liballegro-doc"
version: "2:4.2.2-2.2"
release: "Debian 6.0 (Squeeze)"
platforms: ["linux"]
url: "https://new.carta.tech/ustrdup"
---

# ustrdup(3alleg)

Duplicates a string. Allegro game programming library.

## NAME

ustrdup - Duplicates a string. Allegro game programming library.

## SYNOPSIS

**#include \<allegro.h\>**

**char \*ustrdup(const char \*src)**

## DESCRIPTION

This functions copies the null-terminated string \`src' into a newly allocated area of memory, effectively duplicating it. Example:

```
   void manipulate_string(const char *input_string)
   {
      char *temp_buffer = ustrdup(input_string);
      /* Now we can modify temp_buffer */
      ...
```

## RETURN VALUE

Returns the newly allocated string. This memory must be freed by the caller. Returns NULL if it cannot allocate space for the duplicated string.

## SEE ALSO

[**\_ustrdup**(3alleg)](/_ustrdup/3alleg.md), [**uconvert**(3alleg)](/uconvert/3alleg.md), [**ustrsize**(3alleg)](/ustrsize/3alleg.md), [**ustrsizez**(3alleg)](/ustrsizez/3alleg.md), [**exconfig**(3alleg)](/exconfig/3alleg.md)
