## strcmp

#### OS/161 Reference Manual

### Name

strcmp - compare strings

### Library

Standard C Library (libc, -lc)

### Synopsis

`#include <string.h>`
`int`
`strcmp(const char *`str1`, const char *`str2`);`

### Description

The two strings str1 and str2 are compared lexicographically.

### Return Values

If str1 sorts before str2, -1 is returned.

If str1 sorts after str2, 1 is returned.

If str1 is the same as str2, 0 is returned.

The sort order used is derived from the natural ordering of the numerical values of (unsigned) characters.