# _CP_locate

_CP_locate is equivalent to the following
BASIC statement:

```
locate(string1, string2, ac.expression, vc.expression, start.expression,
position.variable,string3) then result= 1 else result= 0
```

## Syntax

```
int _CP_locate(int* result, CPSTR* string1, CPSTR* string2, int ac.expression,
int vc.expression,int start.expression, int * position.variable, CPSTR* string3)
```

## Description

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

## Example(s)

```
/* Prints "1 2". */

CPSTR * s = _CP_mkstr("a\376b");
CPSTR * t = _CP_mkstr("b");
int r,l;

_CP_locate(&r,t,s,0,0,0,&l,_CP_str_null);
_CP_unix_env();
printf("%d %d\n", r, l);
```

## See also

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

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