# _CP_str_copy

_CP_str_copy makes a copy of a CPSTR.
The actual contents of the string are copied rather than just the
pointer.

## Syntax

```
CPSTR * _CP_str_copy(CPSTR * string)
```

## Example(s)

This example assigns the string `"Null value"` to all the elements of the array `a`. Note that copies are necessary so that each element can be modified
without affecting the others.

```
CPSTR * s = _CP_mkstr("Null value");
CPSTR * a[20];
int i;

for (i = 0; i < 20; i++)
a[i] = _CP_str_copy(s);
```

## See also

- [C functions overview](https://d3codex.com/cfunctions/c-functions-overview/)

---
Source: https://d3codex.com/cfunctions/cp-str-copy/ - part of the D3Codex reference.
