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

What is the function of strcmp function?

爱喝马黛茶的安东尼
爱喝马黛茶的安东尼Original
2019-07-23 13:36:5572206browse

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(字符串,字符串);

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!

Statement:
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