# PetscMergeIntArray
Merges two SORTED `PetscInt` arrays, removes duplicate elements. 
## Synopsis
```
#include "petscsys.h"  
PetscErrorCode PetscMergeIntArray(PetscInt an, const PetscInt aI[], PetscInt bn, const PetscInt bI[], PetscInt *n, PetscInt **L)
```
Not Collective


## Input Parameters

- ***an  -*** number of values in the first array
- ***aI  -*** first sorted array of integers
- ***bn  -*** number of values in the second array
- ***bI  -*** second array of integers



## Output Parameters

- ***n   -*** number of values in the merged array
- ***L   -*** merged sorted array, this is allocated if an array is not provided





## See Also
 `PetscSortReal()`, `PetscSortIntWithPermutation()`, `PetscSortInt()`, `PetscSortIntWithArray()`

## Level
intermediate

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


---
[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)  
