strcmp和stricmp、strcmpi三者之間的區別


#include <string.h>
#include <stdio.h>


原型:extern int strcmp(const void *s1, const void *s2);

用法:#include <string.h>

功能:比較字符串s1和s2是否相同,區分大小寫

說明:如果s1=s2則返回零,否則返回非零值。


原型:extern int stricmp(char *s1,char * s2);

用法:#include <string.h>

功能:比較字符串s1和s2,但不區分字母的大小寫

說明:strcmpi是到stricmp的宏定義,實際未提供此函數。
當s1<s2時,返回值<0
當s1=s2時,返回值=0
當s1>s2時,返回值>0

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM