C99 7.21.4:
The sign of a nonzero value returned by the comparison functions
memcmp, strcmp, and strncmp is determined by the sign of
the difference between the values of the first pair of characters (both
interpreted as unsigned char) that differ in the objects being
compared.
Note in particular that the result doesn't depend on the current locale; LC_COLLATE
(see C99 7.11) affects strcoll()
and strxfrm()
, but not strcmp()
.