---
name: "ustrncmp"
section: "3alleg4"
platform: "linux"
package: "allegro4-doc"
version: "2:4.4.3.1-5"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/ustrncmp/3alleg4"
---

# ustrncmp(3alleg4)

Compares up to n letters of two strings. Allegro game programming library.

## NAME

ustrncmp - Compares up to n letters of two strings. Allegro game programming library.

## SYNOPSIS

**#include \<allegro.h\>**

**int ustrncmp(const char \*s1, const char \*s2, int n);**

## DESCRIPTION

This function compares up to \`n' characters of \`s1' and \`s2'. Example:

```
   if (ustrncmp(prefix, long_string, ustrlen(prefix)) == 0) {
      /* long_string starts with prefix */
   }
```

## RETURN VALUE

Returns zero if the substrings are equal, a positive number if \`s1' comes after \`s2' in the ASCII collating sequence, else a negative number.

## SEE ALSO

**uconvert**(3alleg4), **ustrsize**(3alleg4), **ustrsizez**(3alleg4), **ustrcmp**(3alleg4), **ustricmp**(3alleg4), **ustrnicmp**(3alleg4)
