# _CP_fold

_CP_fold is equivalent to the `*result* = fold(*string1*, *string2*, *string3*)` BASIC statement.

## Syntax

```
int _CP_fold(CPSTR** result, CPSTR* string1, CPSTR* string2, CPSTR* string3)
```

## Description

This function returns -1 if
an error occurs. The error code is contained in _CP_errno.

## Example(s)

```
/* Prints "A|long|strin|g" */

CPSTR * s = _CP_mkstr("A long string");
CPSTR * t = _CP_mkstr("5");
CPSTR * u = _CP_mkstr("|");

_CP_fold(&s,s,t,u);
_CP_print(s);
```

## See also

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

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