文章目录
一. 库函数strcmp()
参考文档:strcmp - C++ Reference (cplusplus.com)
int strcmp ( const char * str1, const char * str2 );
函数描述:比较两个字符串。
比较C字符串str1和C字符串str2。
这个函数开始比较每个字符串的第一个字符。如果它们彼此相等,则继续执行以下对,直到字符不同或达到终止空字符为止。
这个函数执行字符的二进制比较。有关考虑特定于语言环境规则的函数,请参见strcoll - C++ Reference (cplusplus.com)。
函数参数:
- str1:要比较的C字符串。
- str2