# _CP_str_alloc

_CP_str_alloc allocates space for a
CPSTR. It is the equivalent of malloc(), but returns
a CPSTR*. The *expression* should contain the length
of the string buffer to allocate. A 0 is returned if a failure occurs.

## Syntax

```
CPSTR* _CP_str_alloc(int expression)
```
Note: The CPSTR* that _CP_str_alloc creates
must be later freed with _CP_str_free, not free().

## See also

- [C functions overview](https://d3codex.com/cfunctions/c-functions-overview/)
- [_CP_str_free](https://d3codex.com/cfunctions/cp-str-free/)
- [_CP_str_realloc](https://d3codex.com/cfunctions/cp-str-realloc/)

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