# _CP_occurs

_CP_occurs is equivalent to the `*result* = occurs(*string*, *expression*)` BASIC function.

## Syntax

```
int _CP_occurs(CPSTR** result, CPSTR* string, int expression)
```

## Description

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

## Example(s)

```
/* Prints "a". */

CPSTR * s = _CP_mkstr("a\376a");

_CP_occurs(&s,s,2);
_CP_print(s);
```

## See also

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

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