HP C/iX Library Reference Manual (30026-90004)

Chapter 5 333
HP C/iX Library Function Descriptions
strcmp
strcmp
Compares two strings and returns an integer indicating the result of the comparison.
Syntax
#include <string.h>
int strcmp(const char *
s1
, const char *
s2
);
Parameters
s1
,
s2
Pointers to character strings.
Return Values
< 0 The
s1
parameter is less than
s2
= 0 The
s1
and
s2
parameters are equal.
> 0 The
s1
parameter is greater than
s2
.
Description
In the strcmp function,
s1
and
s2
are character pointers to the null-terminated character
strings to be compared. This function compares the entire strings, stopping as soon as the
result is determined or when a null character is encountered.
See Also
strncmp(), strcoll(), memcmp(), ANSI C 4.11.4.2, POSIX.1 8.1