# _CP_root

_CP_root is equivalent to the `root *string1*, *string2* to *result*` BASIC statement.

## Syntax

```
int _CP_root(CPSTR* string1, CPSTR* string2, int* result)
```

## Description

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

## Example(s)

```
/* Gets the first item-ID which contains "a" as attribute 1. */

CPSTR * n = _CP_mkstr("myfile");
CPSTR * a = _CP_mkstr("a1");
CPSTR * op = _CP_mkstr("n");
CPSTR * k = _CP_mkstr("a");
CPSTR * i = _CP_str_null;
int r,dummy;

_CP_root(n,a,&r);
_CP_key(op,r,&k,&i,&dummy);
```

## See also

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

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