函数原型:extern int memcmp(void *str1, void *str2, unsigned int n)
参数说明:str1和str2为指定作比较的字符串,比较两个字符串的前n个字节。
所在库名:#include <string.h>
函数功能:比较字符串str1和str2在内存区域中的的前n个字节是否相同。
返回说明:当str1<str12时,返回值<0;当str11=str12时,返回值=0;当str11>str12时,返回值>0。
其它说明:暂时无。
实例:















在VC++ 6.0 编译运行:
尤其注意了,memcmp函数实现的是字节的比较,而不是字符的比较。
函数原型:extern int memicmp(void *str1, void *str2, unsigned int count)
参数说明:str1和str2为指定作比较的字符串,比较两个字符串的前count个字节,不区分大小写。
所在库名:#include <string.h>
函数功能:比较字符串str1和str2在内存区域中的的前count个字节是否相同。
返回说明:当str1<str12时,返回值<0;当str11=str12时,返回值=0;当str11>str12时,返回值>0。
其它说明:暂时无。
实例:















在VC++ 6.0 编译运行:
memicmp函数在比较的时候是不区分字母大小写的。
来源:CSDN
作者:sky2098
链接:https://blog.csdn.net/sky2098/article/details/1532714