1STRCMP(3) Linux Programmer's Manual STRCMP(3)
2
3
4
6 strcmp, strncmp - compare two strings
7
9 #include <string.h>
10
11 int strcmp(const char *s1, const char *s2);
12
13 int strncmp(const char *s1, const char *s2, size_t n);
14
16 The strcmp() function compares the two strings s1 and s2. It returns
17 an integer less than, equal to, or greater than zero if s1 is found,
18 respectively, to be less than, to match, or be greater than s2.
19
20 The strncmp() function is similar, except it only compares the first
21 (at most) n characters of s1 and s2.
22
24 The strcmp() and strncmp() functions return an integer less than, equal
25 to, or greater than zero if s1 (or the first n bytes thereof) is found,
26 respectively, to be less than, to match, or be greater than s2.
27
29 SVr4, 4.3BSD, C89, C99.
30
32 bcmp(3), memcmp(3), strcasecmp(3), strcoll(3), strncasecmp(3), strverā
33 scmp(3), wcscmp(3), wcsncmp(3)
34
36 This page is part of release 3.22 of the Linux man-pages project. A
37 description of the project, and information about reporting bugs, can
38 be found at http://www.kernel.org/doc/man-pages/.
39
40
41
42 2009-04-21 STRCMP(3)