In linux, is the return value of the c function strcmp questionable?

Source: Internet
Author: User
In linux, is the return value of the c function strcmp questionable? -- Linux general technology-Linux programming and kernel information. The following is a detailed description. In linux, is the return value of the c function strcmp questionable?
Strcmp function explanation:
NAME
Strcmp, strncmp-compare two strings

SYNOPSIS
# Include

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
Zero if s1 is found, respectively, to be less than, to match, or be greater than s2.

The strncmp () function is similar, except t it only compares the first (at most) n characters of s1 and s2.

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.

CONFORMING
SVr4, 4.3BSD, C89, C99.

SEE ALSO
Bcmp (3), memcmp (3), strcasecmp (3), strcoll (3), strncasecmp (3), wcscmp (3), wcsncmp (3)

The return value is an integer. What is the return value when the first parameter const char * s1 is a NULL pointer, that is, NULL?
I am equal to NULL. When the result is compiled, the following message is displayed: warning: comparison between pointer and integer.
What is it ?????


Thank you !!
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.