#include<stdio.h>
int strcmp(const char *str1,const char *str2){
int temp;
while(!(temp=*str1++-*str2++)&&*str1!='\0');
if(temp<0)
return -1;
else if(temp>0)
return 1;
return temp;
}
int main(void)
{
printf("%d",strcmp("abcd","abc"));
}
c语言strcmp实现
最新推荐文章于 2024-03-26 10:15:17 发布