# PetscFindInt
Finds `PetscInt` in a sorted array of `PetscInt` 
## Synopsis
```
#include "petscsys.h"  
PetscErrorCode PetscFindInt(PetscInt key, PetscInt n, const PetscInt X[], PetscInt *loc)
```
Not Collective


## Input Parameters

- ***key -*** the integer to locate
- ***n   -*** number of values in the array
- ***X  -*** array of integers



## Output Parameter

- ***loc -*** the location if found, otherwise -(slot+1) where slot is the place the value would go





## See Also
 `PetscIntSortSemiOrdered()`, `PetscSortInt()`, `PetscSortIntWithArray()`, `PetscSortRemoveDupsInt()`

## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/sys/utils/sorti.c.html#PetscFindInt">src/sys/utils/sorti.c</A>

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/impls/plex/tutorials/ex10.c.html">src/dm/impls/plex/tutorials/ex10.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/impls/plex/tutorials/ex11.c.html">src/dm/impls/plex/tutorials/ex11.c.html</A><BR>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/sys/utils/sorti.c)


[Index of all Sys routines](index.md)  
[Table of Contents for all manual pages](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
