strcmp 函数 man 手册翻译

STRCMP(3)                        Linux Programmer's Manual                        STRCMP(3)

NAME
       strcmp, strncmp - compare two strings		//比较两个字符串

SYNOPSIS
       #include <string.h>

       int strcmp(const char *s1, const char *s2);

       int strncmp(const char *s1, const char *s2, size_t n);

DESCRIPTION
       The strcmp() function compares the two strings s1 and s2. It returns an integer less than, equal to, or greater than zero if s1 is found, respectively, to be less than, to match, or be greater than s2.
	   /*strcmp() 函数是用于比较两个字符串 s1 和 s2。函数的返回值是一个 int 类型值,如果 s1 小于 s2 返回负值,如果 s1 等于 s2 返回 0,如果 s1 大于 s2 返回整数。*/

       The strncmp() function is similar, except it compares only the first (at most) n bytes of s1 and s2.
	   /*strncmp 函数和 strcmp 函数相似,不过该函数只比较 s1 和 s2 前面最多 n 个字节*/

RETURN VALUE
       The strcmp() and strncmp() functions return an integer less than, equal to, or greater than zero if s1 (or the first n bytes thereof) is found, respectively, to be less than, to match, or be greater than s2.
	   /*strcmp() 和 strncmp() 函数的返回值是一个 int 类型值,如果 s1 小于 s2 返回负值,如果 s1 等于 s2 返回 0,如果 s1 大于 s2 返回整数。*/
	   /******************************   Note   ******************************/
	   /**实际操作中当 s1 > s2 时返回 1,s1 = s2,返回 0,s1 < s2 返回 -1**/
	   /**只能比较字符串,不能比较字符,否则报段错误**/
	   /**s1 和 s2 均不能为 NULL,否则报段错误**/

ATTRIBUTES
       For an explanation of the terms used in this section, see attributes(7).

       ┌────────────────────┬───────────────┬─────────┐
       │Interface           │ Attribute     │ Value   │
       ├────────────────────┼───────────────┼─────────┤
       │strcmp(), strncmp() │ Thread safety │ MT-Safe │
       └────────────────────┴───────────────┴─────────┘
CONFORMING TO
       POSIX.1-2001, POSIX.1-2008, C89, C99, SVr4, 4.3BSD.

SEE ALSO
       bcmp(3), memcmp(3), strcasecmp(3), strcoll(3),  string(3),  strncasecmp(3),  strverscmp(3), wcscmp(3), wcsncmp(3)

COLOPHON
       This page is part of release 4.04 of the Linux man-pages project. A description of the project, information about reporting bugs, and the latest version of this  page, can be found at http://www.kernel.org/doc/man-pages/.

                                         2015-08-08                               STRCMP(3)

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值