strcmp(), strncmp() - compare strings
#include <string.h>
int strcmp (const char *s1, const char *s2)
int strncmp (const char *s1, const char *s2, size_t len)
The strcmp(3) and strncmp(3) functions lexicographically compare the NUL-terminated strings s1 and s2.
The strcmp(3) and strncmp(3) return an integer
greater than, equal to, or less than 0, according as the string
s1 is greater than, equal to, or less than the string
s2. The comparison is done using unsigned characters, so
that \200
is greater than \0
.
Unlike strcmp(3), strncmp(3) compares not more than len characters.
memcmp(3)
strcoll(3)
strxfrm(3)