Home > Common Problem > What is the function of strcmp function?

What is the function of strcmp function?

爱喝马黛茶的安东尼
Release: 2019-07-23 13:36:55
Original
72213 people have browsed it

What is the function of strcmp function?

The strcmp function compares the sizes of two strings and returns the comparison result.

The general form is:

i=strcmp(字符串,字符串);
Copy after login

Related recommendations: "FAQ"

Among them, both string 1 and string 2 are acceptable is a string constant or variable; i is an integer variable used to store the comparison result. The comparison result is specified as follows:

①If string 1 is less than string 2, the strcmp function returns a negative value;

②String 1 is equal to string 2, and the strcmp function returns zero;

③String 1 is greater than string 2, and the strcmp function returns a positive value.

The above is the detailed content of What is the function of strcmp function?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template