# _CP_SLEN

_CP_SLEN returns the length of the `CPSTR*, *string*`.

## Syntax

```
int _CP_SLEN(CPSTR* string)
```
Warning: The _CP_SLEN() macro
should never be used to change the length of a CPSTR. Doing so can
cause data corruption.

## Example(s)

```
CPSTR * s = _CP_mkstr("hi");
int i = _CP_SLEN(s);
```

## See also

- [C functions overview](https://d3codex.com/cfunctions/c-functions-overview/)
- [_CP_SADDR](https://d3codex.com/cfunctions/cp-saddr/)
- [CPSTR](https://d3codex.com/cfunctions/cpstr/)

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