# _CP_mkstr

_CP_mkstr dynamically allocates a CPSTR*
and fills it with a copy of *cstring*.

## Syntax

```
CPSTR* _CP_mkstr(char* cstring)
```
This function is provided for convenience. The function _CP_mkstrl() is more efficient since it does not need to
scan the string again to calculate the length.

Note: The CPSTR*
created must be later freed with _CP_str_free.

## Example(s)

```
CPSTR * s = _CP_mkstr("This is a string");
```

## See also

- [C functions overview](https://d3codex.com/cfunctions/c-functions-overview/)
- [_CP_print](https://d3codex.com/cfunctions/cp-print/)
- [_CP_print_n](https://d3codex.com/cfunctions/cp-print-n/)

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