Strcmp function – Zilog Z80380 User Manual
Page 79

UM004001-COR1103
4–15
Run Time Environment
Library Functions
strcmp
FUNCTION
Header file statement:
#include
Syntax:
int strcmp
(const char *string1, const char *string2);
The strcmp function compares string1 and string2 lexicographically and returns a value indi-
cating their relationship, as follows:
Value Meaning
< 0
string1 less than string2
= 0
string1 identical to string2
> 0
string1 greater than string2
The strcmp function operates on null-terminated strings. The string arguments to these func-
tions are expected to contain a null character (‘\0’) marking the end of the string.
Note that two strings containing characters located between ‘Z’ and ‘a’ in the ASCII table
(‘[’, ‘\’_’]’, ‘^’, ‘_’, and ‘‘’) compare differently depending on their case. For example, the
two strings, "ABCDE" and "ABCD^", compare one way if the comparison is lowercase
("abcde" > "abcd^") and compare the other way ("ABCDE" < "ABCD^") if it is uppercase.
Return Value
The return values for this functions are described above.
Parameter
Description
string1
String to compare
string2
String to compare