c语言的比较函数是strcmp函数。
函数原型:
int strcmp(const char *s1, const char *s2)
头文件:
#include <string.h>
参数:
当s1<s2时,返值<0
当s1=s2时,返值=0
当s1>s2时,返值>0
比较过程:两个字符串自左向右逐个字符比较,ASCII值大者为大,直到出现不同的字符或遇'
原创 | 2022-10-12 01:14:15 |浏览:1.6万
c语言的比较函数是strcmp函数。
函数原型:
int strcmp(const char *s1, const char *s2)
头文件:
#include <string.h>
参数:
当s1<s2时,返值<0
当s1=s2时,返值=0
当s1>s2时,返值>0
比较过程:两个字符串自左向右逐个字符比较,ASCII值大者为大,直到出现不同的字符或遇'