1STRCMP(3)                  Linux Programmer's Manual                 STRCMP(3)
2
3
4

NAME

6       strcmp, strncmp - compare two strings
7

SYNOPSIS

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

DESCRIPTION

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 compares only the first
21       (at most) n bytes of s1 and s2.
22

RETURN VALUE

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

ATTRIBUTES

29       For  an  explanation  of  the  terms  used   in   this   section,   see
30       attributes(7).
31
32       ┌────────────────────┬───────────────┬─────────┐
33Interface           Attribute     Value   
34       ├────────────────────┼───────────────┼─────────┤
35strcmp(), strncmp() │ Thread safety │ MT-Safe │
36       └────────────────────┴───────────────┴─────────┘

CONFORMING TO

38       POSIX.1-2001, POSIX.1-2008, C89, C99, SVr4, 4.3BSD.
39

SEE ALSO

41       bcmp(3),   memcmp(3),   strcasecmp(3),   strcoll(3),  string(3),  strn‐
42       casecmp(3), strverscmp(3), wcscmp(3), wcsncmp(3)
43

COLOPHON

45       This page is part of release 4.15 of the Linux  man-pages  project.   A
46       description  of  the project, information about reporting bugs, and the
47       latest    version    of    this    page,    can     be     found     at
48       https://www.kernel.org/doc/man-pages/.
49
50
51
52                                  2015-08-08                         STRCMP(3)
Impressum