---
name: "memisort"
section: "3pub"
platform: "linux"
package: "publib-dev"
version: "0.40-4"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/memisort"
---

# memisort(3pub)

insert new element into sorted array

## NAME

memisort - insert new element into sorted array

## SYNOPSIS

```
#include <publib.h>
void memisort(void *base, size_t nelem, size_t elsize, const void *new,
		int (*comp)(const void *, const void *));
```

## DESCRIPTION

*memisort* inserts a new element into a sorted array, in the proper place to keep the array sorted.  *base*, *elsize*, *nelem*, and *comp* are as for [*qsort*(3)](/qsort/3.md), *new* is a pointer to the new element.

## SEE ALSO

publib(3), [qsort(3)](/qsort/3.md)

## AUTHOR

Lars Wirzenius (lars.wirzenius@helsinki.fi)
